repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
phprtflite/PHPRtfLite | lib/PHPRtfLite/ParFormat.php | PHPRtfLite_ParFormat.getContent | public function getContent()
{
$content = '';
switch ($this->_alignment) {
case self::TEXT_ALIGN_RIGHT:
$content .= '\qr ';
break;
case self::TEXT_ALIGN_CENTER:
$content .= '\qc ';
break;
case self::TEXT_ALIGN_JUSTIFY:
$content .= '\qj ';
break;
default:
$content .= '\ql ';
break;
}
if ($this->_indentFirstLine != 0) {
$content .= '\fi' . PHPRtfLite_Unit::getUnitInTwips($this->_indentFirstLine) . ' ';
}
if ($this->_indentLeft > 0) {
$content .= '\li' . PHPRtfLite_Unit::getUnitInTwips($this->_indentLeft) . ' ';
}
if ($this->_indentRight > 0) {
$content .= '\ri' . PHPRtfLite_Unit::getUnitInTwips($this->_indentRight) .' ';
}
if ($this->_spaceBefore > 0) {
$content .= '\sb' . $this->_spaceBefore.' ';
}
if ($this->_spaceAfter > 0) {
$content .= '\sa' . $this->_spaceAfter.' ';
}
if ($this->_spaceBetweenLines > 0) {
$content .= '\sl' . $this->_spaceBetweenLines.' ';
}
if ($this->_border) {
$content .= $this->_border->getContent('\\');
}
if ($this->_shading > 0) {
$content .= '\shading' . $this->_shading . ' ';
}
if ($this->_backgroundColor && $this->_colorTable) {
$colorIndex = $this->_colorTable->getColorIndex($this->_backgroundColor);
if ($colorIndex !== false) {
$content .= '\cbpat' . $colorIndex . ' ';
}
}
return $content;
} | php | public function getContent()
{
$content = '';
switch ($this->_alignment) {
case self::TEXT_ALIGN_RIGHT:
$content .= '\qr ';
break;
case self::TEXT_ALIGN_CENTER:
$content .= '\qc ';
break;
case self::TEXT_ALIGN_JUSTIFY:
$content .= '\qj ';
break;
default:
$content .= '\ql ';
break;
}
if ($this->_indentFirstLine != 0) {
$content .= '\fi' . PHPRtfLite_Unit::getUnitInTwips($this->_indentFirstLine) . ' ';
}
if ($this->_indentLeft > 0) {
$content .= '\li' . PHPRtfLite_Unit::getUnitInTwips($this->_indentLeft) . ' ';
}
if ($this->_indentRight > 0) {
$content .= '\ri' . PHPRtfLite_Unit::getUnitInTwips($this->_indentRight) .' ';
}
if ($this->_spaceBefore > 0) {
$content .= '\sb' . $this->_spaceBefore.' ';
}
if ($this->_spaceAfter > 0) {
$content .= '\sa' . $this->_spaceAfter.' ';
}
if ($this->_spaceBetweenLines > 0) {
$content .= '\sl' . $this->_spaceBetweenLines.' ';
}
if ($this->_border) {
$content .= $this->_border->getContent('\\');
}
if ($this->_shading > 0) {
$content .= '\shading' . $this->_shading . ' ';
}
if ($this->_backgroundColor && $this->_colorTable) {
$colorIndex = $this->_colorTable->getColorIndex($this->_backgroundColor);
if ($colorIndex !== false) {
$content .= '\cbpat' . $colorIndex . ' ';
}
}
return $content;
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"switch",
"(",
"$",
"this",
"->",
"_alignment",
")",
"{",
"case",
"self",
"::",
"TEXT_ALIGN_RIGHT",
":",
"$",
"content",
".=",
"'\\qr '",
";",
"break",
";",
"case",
"sel... | gets rtf code of paragraph
@return string rtf code | [
"gets",
"rtf",
"code",
"of",
"paragraph"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/ParFormat.php#L373-L435 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Font.php | PHPRtfLite_Font.setFontTable | public function setFontTable(PHPRtfLite_DocHead_FontTable $fontTable)
{
if (!empty($this->_fontFamily)) {
$fontTable->add($this->_fontFamily);
}
$this->_fontTable = $fontTable;
} | php | public function setFontTable(PHPRtfLite_DocHead_FontTable $fontTable)
{
if (!empty($this->_fontFamily)) {
$fontTable->add($this->_fontFamily);
}
$this->_fontTable = $fontTable;
} | [
"public",
"function",
"setFontTable",
"(",
"PHPRtfLite_DocHead_FontTable",
"$",
"fontTable",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_fontFamily",
")",
")",
"{",
"$",
"fontTable",
"->",
"add",
"(",
"$",
"this",
"->",
"_fontFamily",
")",... | sets rtf font table
@param PHPRtfLite_DocHead_FontTable $fontTable | [
"sets",
"rtf",
"font",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Font.php#L154-L160 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Font.php | PHPRtfLite_Font.setStriked | public function setStriked($striked = true)
{
$this->_isStriked = $striked;
if ($striked) {
$this->_isDoubleStriked = false;
}
} | php | public function setStriked($striked = true)
{
$this->_isStriked = $striked;
if ($striked) {
$this->_isDoubleStriked = false;
}
} | [
"public",
"function",
"setStriked",
"(",
"$",
"striked",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_isStriked",
"=",
"$",
"striked",
";",
"if",
"(",
"$",
"striked",
")",
"{",
"$",
"this",
"->",
"_isDoubleStriked",
"=",
"false",
";",
"}",
"}"
] | sets striked text
@param boolean $strike | [
"sets",
"striked",
"text"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Font.php#L278-L285 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Font.php | PHPRtfLite_Font.setDoubleStriked | public function setDoubleStriked($striked = true)
{
$this->_isDoubleStriked = $striked;
if ($striked) {
$this->_isStriked = false;
}
} | php | public function setDoubleStriked($striked = true)
{
$this->_isDoubleStriked = $striked;
if ($striked) {
$this->_isStriked = false;
}
} | [
"public",
"function",
"setDoubleStriked",
"(",
"$",
"striked",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_isDoubleStriked",
"=",
"$",
"striked",
";",
"if",
"(",
"$",
"striked",
")",
"{",
"$",
"this",
"->",
"_isStriked",
"=",
"false",
";",
"}",
"}"
] | sets double striked text
@param boolean $strike | [
"sets",
"double",
"striked",
"text"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Font.php#L304-L311 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Font.php | PHPRtfLite_Font.getContent | public function getContent()
{
$content = '';
if ($this->_size > 0) {
$content .= '\fs' . ($this->_size * 2) . ' ';
}
if ($this->_fontFamily && $this->_fontTable) {
$fontIndex = $this->_fontTable->getFontIndex($this->_fontFamily);
if ($fontIndex !== false) {
$content .= '\f' . $fontIndex . ' ';
}
}
if ($this->_color && $this->_colorTable) {
$colorIndex = $this->_colorTable->getColorIndex($this->_color);
if ($colorIndex !== false) {
$content .= '\cf' . $colorIndex . ' ';
}
}
if ($this->_backgroundColor && $this->_colorTable) {
$colorIndex = $this->_colorTable->getColorIndex($this->_backgroundColor);
if ($colorIndex !== false) {
$content .= '\chcbpat' . $colorIndex . ' ';
}
}
if ($this->_isBold) {
$content .= '\b ';
}
if ($this->_isItalic) {
$content .= '\i ';
}
if ($this->_isUnderlined) {
$content .= '\ul ';
}
if ($this->_animation) {
$content .= '\animtext' . $this->_animation;
}
if ($this->_isStriked) {
$content .= '\strike ' . $this->_animation;
}
elseif ($this->_isDoubleStriked) {
$content .= '\striked1 ' . $this->_animation;
}
return $content;
} | php | public function getContent()
{
$content = '';
if ($this->_size > 0) {
$content .= '\fs' . ($this->_size * 2) . ' ';
}
if ($this->_fontFamily && $this->_fontTable) {
$fontIndex = $this->_fontTable->getFontIndex($this->_fontFamily);
if ($fontIndex !== false) {
$content .= '\f' . $fontIndex . ' ';
}
}
if ($this->_color && $this->_colorTable) {
$colorIndex = $this->_colorTable->getColorIndex($this->_color);
if ($colorIndex !== false) {
$content .= '\cf' . $colorIndex . ' ';
}
}
if ($this->_backgroundColor && $this->_colorTable) {
$colorIndex = $this->_colorTable->getColorIndex($this->_backgroundColor);
if ($colorIndex !== false) {
$content .= '\chcbpat' . $colorIndex . ' ';
}
}
if ($this->_isBold) {
$content .= '\b ';
}
if ($this->_isItalic) {
$content .= '\i ';
}
if ($this->_isUnderlined) {
$content .= '\ul ';
}
if ($this->_animation) {
$content .= '\animtext' . $this->_animation;
}
if ($this->_isStriked) {
$content .= '\strike ' . $this->_animation;
}
elseif ($this->_isDoubleStriked) {
$content .= '\striked1 ' . $this->_animation;
}
return $content;
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"_size",
">",
"0",
")",
"{",
"$",
"content",
".=",
"'\\fs'",
".",
"(",
"$",
"this",
"->",
"_size",
"*",
"2",
")",
".",
"' '",
";",
... | gets rtf code of font
@return string rtf code | [
"gets",
"rtf",
"code",
"of",
"font"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Font.php#L349-L398 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Font.php | PHPRtfLite_Font.getClosingContent | public function getClosingContent()
{
$content = '';
if ($this->_color) {
$content .= '\cf0 ';
}
if ($this->_backgroundColor) {
$content .= '\chcbpat0 ';
}
if ($this->_isBold) {
$content .= '\b0 ';
}
if ($this->_isItalic) {
$content .= '\i0 ';
}
if ($this->_isUnderlined) {
$content .= '\ul0 ';
}
return $content;
} | php | public function getClosingContent()
{
$content = '';
if ($this->_color) {
$content .= '\cf0 ';
}
if ($this->_backgroundColor) {
$content .= '\chcbpat0 ';
}
if ($this->_isBold) {
$content .= '\b0 ';
}
if ($this->_isItalic) {
$content .= '\i0 ';
}
if ($this->_isUnderlined) {
$content .= '\ul0 ';
}
return $content;
} | [
"public",
"function",
"getClosingContent",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"_color",
")",
"{",
"$",
"content",
".=",
"'\\cf0 '",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_backgroundColor",
")",
"{",
"$",
... | closes font content
@return string | [
"closes",
"font",
"content"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Font.php#L406-L425 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.setParFormat | public function setParFormat(PHPRtfLite_ParFormat $parFormat)
{
$this->_parFormat = $parFormat;
$parFormat->setColorTable($this->_rtf->getColorTable());
} | php | public function setParFormat(PHPRtfLite_ParFormat $parFormat)
{
$this->_parFormat = $parFormat;
$parFormat->setColorTable($this->_rtf->getColorTable());
} | [
"public",
"function",
"setParFormat",
"(",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
")",
"{",
"$",
"this",
"->",
"_parFormat",
"=",
"$",
"parFormat",
";",
"$",
"parFormat",
"->",
"setColorTable",
"(",
"$",
"this",
"->",
"_rtf",
"->",
"getColorTable",
"(",
"... | sets paragraph format for image
@param PHPRtfLite_ParFormat $parFormat | [
"sets",
"paragraph",
"format",
"for",
"image"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L134-L138 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.getImageRtfWidth | private function getImageRtfWidth()
{
if ($this->_width > 0) {
return PHPRtfLite_Unit::getUnitInTwips($this->_width);
}
$imageWidth = $this->_imageWidth ? $this->_imageWidth : 100;
if ($this->_height > 0) {
$imageHeight = $this->_imageHeight ? $this->_imageHeight : 100;
$width = ($imageWidth / $imageHeight) * $this->_height;
return PHPRtfLite_Unit::getUnitInTwips($width);
}
return PHPRtfLite_Unit::getPointsInTwips($imageWidth);
} | php | private function getImageRtfWidth()
{
if ($this->_width > 0) {
return PHPRtfLite_Unit::getUnitInTwips($this->_width);
}
$imageWidth = $this->_imageWidth ? $this->_imageWidth : 100;
if ($this->_height > 0) {
$imageHeight = $this->_imageHeight ? $this->_imageHeight : 100;
$width = ($imageWidth / $imageHeight) * $this->_height;
return PHPRtfLite_Unit::getUnitInTwips($width);
}
return PHPRtfLite_Unit::getPointsInTwips($imageWidth);
} | [
"private",
"function",
"getImageRtfWidth",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_width",
">",
"0",
")",
"{",
"return",
"PHPRtfLite_Unit",
"::",
"getUnitInTwips",
"(",
"$",
"this",
"->",
"_width",
")",
";",
"}",
"$",
"imageWidth",
"=",
"$",
"th... | gets rtf image width
@return integer | [
"gets",
"rtf",
"image",
"width"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L235-L249 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.getImageRtfHeight | private function getImageRtfHeight()
{
if ($this->_height > 0) {
return PHPRtfLite_Unit::getUnitInTwips($this->_height);
}
$imageHeight = $this->_imageHeight ? $this->_imageHeight : 100;
if ($this->_width > 0) {
$imageWidth = $this->_imageWidth ? $this->_imageWidth : 100;
$height = ($imageHeight /$imageWidth) * $this->_width;
return PHPRtfLite_Unit::getUnitInTwips($height);
}
return PHPRtfLite_Unit::getPointsInTwips($imageHeight);
} | php | private function getImageRtfHeight()
{
if ($this->_height > 0) {
return PHPRtfLite_Unit::getUnitInTwips($this->_height);
}
$imageHeight = $this->_imageHeight ? $this->_imageHeight : 100;
if ($this->_width > 0) {
$imageWidth = $this->_imageWidth ? $this->_imageWidth : 100;
$height = ($imageHeight /$imageWidth) * $this->_width;
return PHPRtfLite_Unit::getUnitInTwips($height);
}
return PHPRtfLite_Unit::getPointsInTwips($imageHeight);
} | [
"private",
"function",
"getImageRtfHeight",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_height",
">",
"0",
")",
"{",
"return",
"PHPRtfLite_Unit",
"::",
"getUnitInTwips",
"(",
"$",
"this",
"->",
"_height",
")",
";",
"}",
"$",
"imageHeight",
"=",
"$",
... | gets rtf image height
@return integer | [
"gets",
"rtf",
"image",
"height"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L257-L271 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.createFromFile | public static function createFromFile(PHPRtfLite $rtf, $file, $width = null, $height = null)
{
if (is_readable($file)) {
$stream = fopen($file, 'rb');
$pathInfo = pathinfo($file);
$type = isset($pathInfo['extension']) ? strtolower($pathInfo['extension']) : 'jpeg';
$image = self::create($rtf, $stream, $type, $width, $height);
if ($type != self::TYPE_WMF) {
list($width, $height, $imageType) = getimagesize($file);
$imageType = image_type_to_extension($imageType, false);
$image->setImageWidth($width);
$image->setImageHeight($height);
if ($type != $imageType) {
$image->setImageType($imageType);
}
}
return $image;
}
return self::createMissingImage($rtf, $width, $height);
} | php | public static function createFromFile(PHPRtfLite $rtf, $file, $width = null, $height = null)
{
if (is_readable($file)) {
$stream = fopen($file, 'rb');
$pathInfo = pathinfo($file);
$type = isset($pathInfo['extension']) ? strtolower($pathInfo['extension']) : 'jpeg';
$image = self::create($rtf, $stream, $type, $width, $height);
if ($type != self::TYPE_WMF) {
list($width, $height, $imageType) = getimagesize($file);
$imageType = image_type_to_extension($imageType, false);
$image->setImageWidth($width);
$image->setImageHeight($height);
if ($type != $imageType) {
$image->setImageType($imageType);
}
}
return $image;
}
return self::createMissingImage($rtf, $width, $height);
} | [
"public",
"static",
"function",
"createFromFile",
"(",
"PHPRtfLite",
"$",
"rtf",
",",
"$",
"file",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"if",
"(",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"$",
"stream",
... | creates rtf image from file
@param PHPRtfLite $rtf
@param string $file
@param float $width optional
@param float $height optional
@return PHPRtfLite_Image | [
"creates",
"rtf",
"image",
"from",
"file"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L319-L340 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.createFromString | public static function createFromString(PHPRtfLite $rtf, $string, $type, $width = null, $height = null)
{
$stream = fopen('data://text/plain;base64,' . base64_encode($string), 'rb');
$image = self::create($rtf, $stream, $type, $width, $height);
if ($type != self::TYPE_WMF) {
$imageResource = imagecreatefromstring($string);
$image->setImageWidth(imagesx($imageResource));
$image->setImageHeight(imagesy($imageResource));
}
return $image;
} | php | public static function createFromString(PHPRtfLite $rtf, $string, $type, $width = null, $height = null)
{
$stream = fopen('data://text/plain;base64,' . base64_encode($string), 'rb');
$image = self::create($rtf, $stream, $type, $width, $height);
if ($type != self::TYPE_WMF) {
$imageResource = imagecreatefromstring($string);
$image->setImageWidth(imagesx($imageResource));
$image->setImageHeight(imagesy($imageResource));
}
return $image;
} | [
"public",
"static",
"function",
"createFromString",
"(",
"PHPRtfLite",
"$",
"rtf",
",",
"$",
"string",
",",
"$",
"type",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"$",
"stream",
"=",
"fopen",
"(",
"'data://text/plain;base... | creates rtf image from string
@param PHPRtfLite $rtf
@param string $string
@param string $type (represented by class constants)
@param float $width optional
@param float $height optional
@return PHPRtfLite_Image | [
"creates",
"rtf",
"image",
"from",
"string"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L353-L363 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.create | private static function create(PHPRtfLite $rtf, $stream, $type, $width, $height)
{
switch ($type) {
case self::TYPE_WMF:
return new PHPRtfLite_Image_Wmf($rtf, $stream, $width, $height);
default:
$image = new PHPRtfLite_Image_Gd($rtf, $stream, $width, $height);
$image->setImageType($type);
return $image;
}
} | php | private static function create(PHPRtfLite $rtf, $stream, $type, $width, $height)
{
switch ($type) {
case self::TYPE_WMF:
return new PHPRtfLite_Image_Wmf($rtf, $stream, $width, $height);
default:
$image = new PHPRtfLite_Image_Gd($rtf, $stream, $width, $height);
$image->setImageType($type);
return $image;
}
} | [
"private",
"static",
"function",
"create",
"(",
"PHPRtfLite",
"$",
"rtf",
",",
"$",
"stream",
",",
"$",
"type",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_WMF",
":",
"return",
... | factory method
creates rtf image from stream
@param PHPRtfLite $rtf
@param resource $stream
@param string $type (represented by class constants)
@param float $width optional
@param float $height optional
@return PHPRtfLite_Image_Wmf|PHPRtfLite_Image_Gd|PHPRtfLite_Image | [
"factory",
"method",
"creates",
"rtf",
"image",
"from",
"stream"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L377-L387 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.createMissingImage | private static function createMissingImage($rtf, $width, $height)
{
$stream = fopen('data://text/plain;base64,' . self::getMissingImage(), 'rb');
$image = new PHPRtfLite_Image_Gd($rtf, $stream, $width, $height);
$image->setImageType(self::TYPE_PNG);
$image->setIsMissing();
return $image;
} | php | private static function createMissingImage($rtf, $width, $height)
{
$stream = fopen('data://text/plain;base64,' . self::getMissingImage(), 'rb');
$image = new PHPRtfLite_Image_Gd($rtf, $stream, $width, $height);
$image->setImageType(self::TYPE_PNG);
$image->setIsMissing();
return $image;
} | [
"private",
"static",
"function",
"createMissingImage",
"(",
"$",
"rtf",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"stream",
"=",
"fopen",
"(",
"'data://text/plain;base64,'",
".",
"self",
"::",
"getMissingImage",
"(",
")",
",",
"'rb'",
")",
";",... | creates a missing image instance
@param PHPRtfLite $rtf
@param float $width
@param float $height
@return PHPRtfLite_Image_Gd | [
"creates",
"a",
"missing",
"image",
"instance"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L398-L405 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image.php | PHPRtfLite_Image.writeIntoRtfStream | protected function writeIntoRtfStream($startFrom = 0)
{
if (!is_resource($this->_stream)) {
throw new PHPRtfLite_Exception("Image stream has been closed!");
}
fseek($this->_stream, $startFrom);
$rtfImageType = $this->getImageTypeAsRtf();
$rtfStream = $this->_rtf->getWriter();
$rtfStream->write('{\*\shppict {\pict');
if ($this->_border) {
$rtfStream->write($this->_border->getContent());
}
$rtfStream->write($rtfImageType . '\picscalex100\picscaley100');
$rtfStream->write('\picwgoal' . $this->getImageRtfWidth());
$rtfStream->write('\pichgoal' . $this->getImageRtfHeight());
$rtfStream->write(' ');
while (!feof($this->_stream)) {
$stringBuffer = fread($this->_stream, 1024);
$stringHex = bin2hex($stringBuffer);
$rtfStream->write($stringHex);
}
$rtfStream->write('}}');
} | php | protected function writeIntoRtfStream($startFrom = 0)
{
if (!is_resource($this->_stream)) {
throw new PHPRtfLite_Exception("Image stream has been closed!");
}
fseek($this->_stream, $startFrom);
$rtfImageType = $this->getImageTypeAsRtf();
$rtfStream = $this->_rtf->getWriter();
$rtfStream->write('{\*\shppict {\pict');
if ($this->_border) {
$rtfStream->write($this->_border->getContent());
}
$rtfStream->write($rtfImageType . '\picscalex100\picscaley100');
$rtfStream->write('\picwgoal' . $this->getImageRtfWidth());
$rtfStream->write('\pichgoal' . $this->getImageRtfHeight());
$rtfStream->write(' ');
while (!feof($this->_stream)) {
$stringBuffer = fread($this->_stream, 1024);
$stringHex = bin2hex($stringBuffer);
$rtfStream->write($stringHex);
}
$rtfStream->write('}}');
} | [
"protected",
"function",
"writeIntoRtfStream",
"(",
"$",
"startFrom",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"this",
"->",
"_stream",
")",
")",
"{",
"throw",
"new",
"PHPRtfLite_Exception",
"(",
"\"Image stream has been closed!\"",
")",
";... | writes image into rtf stream
@param integer $startFrom
@throws PHPRtfLite_Exception | [
"writes",
"image",
"into",
"rtf",
"stream"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image.php#L423-L451 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Header.php | PHPRtfLite_Container_Header.getTypeAsRtfCode | protected function getTypeAsRtfCode()
{
$rtfType = $this->getRtfType();
switch ($this->_type) {
case self::TYPE_ALL:
if (!$this->_rtf->isOddEvenDifferent()) {
return $rtfType;
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using odd even different!');
case self::TYPE_LEFT:
if ($this->_rtf->isOddEvenDifferent()) {
return $rtfType . 'l';
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using not odd even different!');
case self::TYPE_RIGHT:
if ($this->_rtf->isOddEvenDifferent()) {
return $rtfType . 'r';
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using not odd even different!');
case self::TYPE_FIRST:
if ($this->_rtf->hasSpecialLayoutForFirstPage()) {
return $rtfType . 'f';
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using not special layout for first page!');
default:
throw new PHPRtfLite_Exception('Header/Footer type is not defined! You gave me: ', $this->_type);
}
} | php | protected function getTypeAsRtfCode()
{
$rtfType = $this->getRtfType();
switch ($this->_type) {
case self::TYPE_ALL:
if (!$this->_rtf->isOddEvenDifferent()) {
return $rtfType;
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using odd even different!');
case self::TYPE_LEFT:
if ($this->_rtf->isOddEvenDifferent()) {
return $rtfType . 'l';
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using not odd even different!');
case self::TYPE_RIGHT:
if ($this->_rtf->isOddEvenDifferent()) {
return $rtfType . 'r';
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using not odd even different!');
case self::TYPE_FIRST:
if ($this->_rtf->hasSpecialLayoutForFirstPage()) {
return $rtfType . 'f';
}
throw new PHPRtfLite_Exception('Header/Footer type ' . $this->_type . ' is not allowed, '
. 'when using not special layout for first page!');
default:
throw new PHPRtfLite_Exception('Header/Footer type is not defined! You gave me: ', $this->_type);
}
} | [
"protected",
"function",
"getTypeAsRtfCode",
"(",
")",
"{",
"$",
"rtfType",
"=",
"$",
"this",
"->",
"getRtfType",
"(",
")",
";",
"switch",
"(",
"$",
"this",
"->",
"_type",
")",
"{",
"case",
"self",
"::",
"TYPE_ALL",
":",
"if",
"(",
"!",
"$",
"this",
... | Gets type as rtf code
@return string rtf code
@throws PHPRtfLite_Exception, if type is not allowed,
because of the rtf document specific settings. | [
"Gets",
"type",
"as",
"rtf",
"code"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Header.php#L95-L135 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/Note.php | PHPRtfLite_DocHead_Note.getNumberingTypeAsRtf | public static function getNumberingTypeAsRtf($numbering, $prefix = '\ftnn')
{
switch ($numbering) {
default:
// const name NUMTYPE_ARABIC_NUMBERS
return $prefix . 'ar';
case PHPRtfLite_Footnote::NUMTYPE_ALPHABETH_LC:
return $prefix . 'alc';
case PHPRtfLite_Footnote::NUMTYPE_ALPHABETH_UC:
return $prefix . 'auc';
case PHPRtfLite_Footnote::NUMTYPE_ROMAN_LC:
return $prefix . 'rlc';
case PHPRtfLite_Footnote::NUMTYPE_ROMAN_UC:
return $prefix . 'ruc';
case PHPRtfLite_Footnote::NUMTYPE_CHICAGO;
return $prefix . 'chi';
case PHPRtfLite_Footnote::NUMTYPE_KOREAN_1:
return $prefix . 'chosung';
case PHPRtfLite_Footnote::NUMTYPE_KOREAN_2:
return $prefix . 'ganada';
case PHPRtfLite_Footnote::NUMTYPE_CIRCLE:
return $prefix . 'cnum';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_1:
return $prefix . 'dbnum';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_2:
return $prefix . 'dbnumd';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_3:
return $prefix . 'dbnumt';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_4:
return $prefix . 'dbnumk';
case PHPRtfLite_Footnote::NUMTYPE_DOUBLE_BYTE:
return $prefix . 'dbchar';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_1:
return $prefix . 'gbnum';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_2:
return $prefix . 'gbnumd';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_3:
return $prefix . 'gbnuml';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_4:
return $prefix . 'gbnumk';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_1:
return $prefix . 'zodiac';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_2:
return $prefix . 'zodiacd';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_3:
return $prefix . 'zodiacl';
}
} | php | public static function getNumberingTypeAsRtf($numbering, $prefix = '\ftnn')
{
switch ($numbering) {
default:
// const name NUMTYPE_ARABIC_NUMBERS
return $prefix . 'ar';
case PHPRtfLite_Footnote::NUMTYPE_ALPHABETH_LC:
return $prefix . 'alc';
case PHPRtfLite_Footnote::NUMTYPE_ALPHABETH_UC:
return $prefix . 'auc';
case PHPRtfLite_Footnote::NUMTYPE_ROMAN_LC:
return $prefix . 'rlc';
case PHPRtfLite_Footnote::NUMTYPE_ROMAN_UC:
return $prefix . 'ruc';
case PHPRtfLite_Footnote::NUMTYPE_CHICAGO;
return $prefix . 'chi';
case PHPRtfLite_Footnote::NUMTYPE_KOREAN_1:
return $prefix . 'chosung';
case PHPRtfLite_Footnote::NUMTYPE_KOREAN_2:
return $prefix . 'ganada';
case PHPRtfLite_Footnote::NUMTYPE_CIRCLE:
return $prefix . 'cnum';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_1:
return $prefix . 'dbnum';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_2:
return $prefix . 'dbnumd';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_3:
return $prefix . 'dbnumt';
case PHPRtfLite_Footnote::NUMTYPE_KANJI_4:
return $prefix . 'dbnumk';
case PHPRtfLite_Footnote::NUMTYPE_DOUBLE_BYTE:
return $prefix . 'dbchar';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_1:
return $prefix . 'gbnum';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_2:
return $prefix . 'gbnumd';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_3:
return $prefix . 'gbnuml';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_4:
return $prefix . 'gbnumk';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_1:
return $prefix . 'zodiac';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_2:
return $prefix . 'zodiacd';
case PHPRtfLite_Footnote::NUMTYPE_CHINESE_ZODIAC_3:
return $prefix . 'zodiacl';
}
} | [
"public",
"static",
"function",
"getNumberingTypeAsRtf",
"(",
"$",
"numbering",
",",
"$",
"prefix",
"=",
"'\\ftnn'",
")",
"{",
"switch",
"(",
"$",
"numbering",
")",
"{",
"default",
":",
"// const name NUMTYPE_ARABIC_NUMBERS",
"return",
"$",
"prefix",
".",
"'ar'"... | gets numbering type for notes
@param integer $numbering
@param string $prefix
@return string | [
"gets",
"numbering",
"type",
"for",
"notes"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/Note.php#L206-L253 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Footnote.php | PHPRtfLite_Footnote.setParFormat | public function setParFormat(PHPRtfLite_ParFormat $parFormat)
{
$this->_rtf->registerParFormat($parFormat);
$this->_parFormat = $parFormat;
} | php | public function setParFormat(PHPRtfLite_ParFormat $parFormat)
{
$this->_rtf->registerParFormat($parFormat);
$this->_parFormat = $parFormat;
} | [
"public",
"function",
"setParFormat",
"(",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
")",
"{",
"$",
"this",
"->",
"_rtf",
"->",
"registerParFormat",
"(",
"$",
"parFormat",
")",
";",
"$",
"this",
"->",
"_parFormat",
"=",
"$",
"parFormat",
";",
"}"
] | sets paragraph format
@param PHPRtfLite_ParFormat $parFormat | [
"sets",
"paragraph",
"format"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Footnote.php#L203-L207 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Autoloader.php | PHPRtfLite_Autoloader.autoload | public static function autoload($className)
{
// validate classname
if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/m', $className)) {
throw new Exception("Class name '$className' is invalid");
}
$classFile = self::$_baseDir . '/' . str_replace('_', '/', $className) . '.php';
// check if file exists
if (!file_exists($classFile)) {
throw new Exception("File $classFile does not exist!");
}
require $classFile;
if (!class_exists($className) && !interface_exists($className)) {
throw new Exception("Class $className could not be found!");
}
} | php | public static function autoload($className)
{
// validate classname
if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/m', $className)) {
throw new Exception("Class name '$className' is invalid");
}
$classFile = self::$_baseDir . '/' . str_replace('_', '/', $className) . '.php';
// check if file exists
if (!file_exists($classFile)) {
throw new Exception("File $classFile does not exist!");
}
require $classFile;
if (!class_exists($className) && !interface_exists($className)) {
throw new Exception("Class $className could not be found!");
}
} | [
"public",
"static",
"function",
"autoload",
"(",
"$",
"className",
")",
"{",
"// validate classname",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[a-zA-Z_][a-zA-Z0-9_]*$/m'",
",",
"$",
"className",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Class name '$classN... | loads PHPRtfLite classes
@param string $className
@return boolean returns true, if class could be loaded | [
"loads",
"PHPRtfLite",
"classes"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Autoloader.php#L56-L75 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Base.php | PHPRtfLite_Container_Base.addEmptyParagraph | public function addEmptyParagraph(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
if ($parFormat === null) {
$parFormat = new PHPRtfLite_ParFormat();
}
$element = new PHPRtfLite_Element($this->_rtf, '\\par', $font, $parFormat);
$element->setIsRtfCode();
$this->_elements[] = $element;
return $element;
} | php | public function addEmptyParagraph(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
if ($parFormat === null) {
$parFormat = new PHPRtfLite_ParFormat();
}
$element = new PHPRtfLite_Element($this->_rtf, '\\par', $font, $parFormat);
$element->setIsRtfCode();
$this->_elements[] = $element;
return $element;
} | [
"public",
"function",
"addEmptyParagraph",
"(",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"parFormat",
"===",
"null",
")",
"{",
"$",
"parFormat",
"=",
"new",
"PHPRtfLite... | adds empty paragraph to container.
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@return PHPRtfLite_Element | [
"adds",
"empty",
"paragraph",
"to",
"container",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Base.php#L146-L156 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Base.php | PHPRtfLite_Container_Base.writeText | public function writeText($text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true)
{
$element = new PHPRtfLite_Element($this->_rtf, $text, $font, $parFormat);
if ($convertTagsToRtf) {
$element->setConvertTagsToRtf();
}
$this->_elements[] = $element;
return $element;
} | php | public function writeText($text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true)
{
$element = new PHPRtfLite_Element($this->_rtf, $text, $font, $parFormat);
if ($convertTagsToRtf) {
$element->setConvertTagsToRtf();
}
$this->_elements[] = $element;
return $element;
} | [
"public",
"function",
"writeText",
"(",
"$",
"text",
",",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
",",
"$",
"convertTagsToRtf",
"=",
"true",
")",
"{",
"$",
"element",
"=",
"new",
"PHPRtfLite_El... | writes text to container.
@param string $text Text. Also you can use html style tags. Possible tags:<br>
strong, b- bold; <br>
em - ; <br>
i - italic; <br>
u - underline; <br>
br - line break; <br>
chdate - current date; <br>
chdpl - current date in long format; <br>
chdpa - current date in abbreviated format; <br>
chtime - current time; <br>
chpgn, pagenum - page number ; <br>
tab - tab
sectnum - section number; <br>
line - line break; <br>
page - page break; <br>
sect - section break; <br>
@param PHPRtfLite_Font $font font of text
@param PHPRtfLite_ParFormat $parFormat paragraph format, if null, text is written in the same paragraph.
@param boolean $convertTagsToRtf if false, then html style tags are not replaced with rtf code
@return PHPRtfLite_Element | [
"writes",
"text",
"to",
"container",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Base.php#L183-L195 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Base.php | PHPRtfLite_Container_Base.writeHyperLink | public function writeHyperLink($hyperlink,
$text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true)
{
$element = new PHPRtfLite_Element_Hyperlink($this->_rtf, $text, $font, $parFormat);
$element->setHyperlink($hyperlink);
if ($convertTagsToRtf) {
$element->setConvertTagsToRtf();
}
$this->_elements[] = $element;
return $element;
} | php | public function writeHyperLink($hyperlink,
$text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true)
{
$element = new PHPRtfLite_Element_Hyperlink($this->_rtf, $text, $font, $parFormat);
$element->setHyperlink($hyperlink);
if ($convertTagsToRtf) {
$element->setConvertTagsToRtf();
}
$this->_elements[] = $element;
return $element;
} | [
"public",
"function",
"writeHyperLink",
"(",
"$",
"hyperlink",
",",
"$",
"text",
",",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
",",
"$",
"convertTagsToRtf",
"=",
"true",
")",
"{",
"$",
"element"... | writes hyperlink to container.
@param string $hyperlink hyperlink url (etc. "http://www.phprtf.com")
@param string $text hyperlink text, if empty, hyperlink is written in previous paragraph format.
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@param boolean $convertTagsToRtf if false, then html style tags are not replaced with rtf code
@return PHPRtfLite_Element | [
"writes",
"hyperlink",
"to",
"container",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Base.php#L208-L222 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Base.php | PHPRtfLite_Container_Base.addTable | public function addTable($alignment = PHPRtfLite_Table::ALIGN_LEFT)
{
$table = new PHPRtfLite_Table($this, $alignment);
$this->_elements[] = $table;
return $table;
} | php | public function addTable($alignment = PHPRtfLite_Table::ALIGN_LEFT)
{
$table = new PHPRtfLite_Table($this, $alignment);
$this->_elements[] = $table;
return $table;
} | [
"public",
"function",
"addTable",
"(",
"$",
"alignment",
"=",
"PHPRtfLite_Table",
"::",
"ALIGN_LEFT",
")",
"{",
"$",
"table",
"=",
"new",
"PHPRtfLite_Table",
"(",
"$",
"this",
",",
"$",
"alignment",
")",
";",
"$",
"this",
"->",
"_elements",
"[",
"]",
"="... | adds table to element container.
@param string $alignment Alingment of table. Represented by class constants PHPRtfLite_Table::ALIGN_*<br>
Possible values:<br>
PHPRtfLite_Table::ALIGN_LEFT => 'left',<br>
PHPRtfLite_Table::ALIGN_CENTER => 'center',<br>
PHPRtfLite_Table::ALIGN_RIGHT => 'right'<br>
@return PHPRtfLite_Table | [
"adds",
"table",
"to",
"element",
"container",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Base.php#L236-L242 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Base.php | PHPRtfLite_Container_Base.render | public function render()
{
$stream = $this->_rtf->getWriter();
if ($this instanceof PHPRtfLite_Table_Cell && $this->countElements() == 0) {
$stream->write('{');
$font = $this->getCellFont($this);
if ($font) {
$stream->write($font->getContent());
}
if ((!$this->isVerticalMerged() && !$this->isHorizontalMerged()) || $this->isVerticalMergedFirstInRange()) {
$stream->write('{\~}');
}
$stream->write('}\intbl');
}
$lastKey = $this->countElements() - 1;
foreach ($this->_elements as $key => $element) {
if ($this instanceof PHPRtfLite_Table_Cell && !($element instanceof PHPRtfLite_Table)) {
// table cell initialization
$stream->write('\intbl\itap' . $this->getTable()->getNestDepth() . "\r\n");
$stream->write($this->getCellAlignment());
}
if ($element instanceof PHPRtfLite_Element_Plain) {
$element->render();
continue;
}
$parFormat = null;
if (!($element instanceof PHPRtfLite_Table)) {
$parFormat = $element->getParFormat();
}
if ($parFormat) {
$stream->write($this->_pard);
if ($this instanceof PHPRtfLite_Table_Cell && $lastKey != $key) {
$stream->write('{');
}
$stream->write($parFormat->getContent());
}
$font = $this->getCellFont($element);
if ($font) {
$stream->write($font->getContent());
}
$element->render();
if ($this->needToAddParagraphEnd($key)) {
$stream->write('\par ');
}
if ($font) {
$stream->write($font->getClosingContent());
}
if ($parFormat && $this instanceof PHPRtfLite_Table_Cell && $lastKey != $key) {
$stream->write('}');
}
}
} | php | public function render()
{
$stream = $this->_rtf->getWriter();
if ($this instanceof PHPRtfLite_Table_Cell && $this->countElements() == 0) {
$stream->write('{');
$font = $this->getCellFont($this);
if ($font) {
$stream->write($font->getContent());
}
if ((!$this->isVerticalMerged() && !$this->isHorizontalMerged()) || $this->isVerticalMergedFirstInRange()) {
$stream->write('{\~}');
}
$stream->write('}\intbl');
}
$lastKey = $this->countElements() - 1;
foreach ($this->_elements as $key => $element) {
if ($this instanceof PHPRtfLite_Table_Cell && !($element instanceof PHPRtfLite_Table)) {
// table cell initialization
$stream->write('\intbl\itap' . $this->getTable()->getNestDepth() . "\r\n");
$stream->write($this->getCellAlignment());
}
if ($element instanceof PHPRtfLite_Element_Plain) {
$element->render();
continue;
}
$parFormat = null;
if (!($element instanceof PHPRtfLite_Table)) {
$parFormat = $element->getParFormat();
}
if ($parFormat) {
$stream->write($this->_pard);
if ($this instanceof PHPRtfLite_Table_Cell && $lastKey != $key) {
$stream->write('{');
}
$stream->write($parFormat->getContent());
}
$font = $this->getCellFont($element);
if ($font) {
$stream->write($font->getContent());
}
$element->render();
if ($this->needToAddParagraphEnd($key)) {
$stream->write('\par ');
}
if ($font) {
$stream->write($font->getClosingContent());
}
if ($parFormat && $this instanceof PHPRtfLite_Table_Cell && $lastKey != $key) {
$stream->write('}');
}
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_rtf",
"->",
"getWriter",
"(",
")",
";",
"if",
"(",
"$",
"this",
"instanceof",
"PHPRtfLite_Table_Cell",
"&&",
"$",
"this",
"->",
"countElements",
"(",
")",
"==",
"0"... | renders rtf code for that container
@return string rtf code | [
"renders",
"rtf",
"code",
"for",
"that",
"container"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Base.php#L313-L375 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Base.php | PHPRtfLite_Container_Base.needToAddParagraphEnd | private function needToAddParagraphEnd($key)
{
if (isset($this->_elements[$key + 1])) {
$nextElement = $this->_elements[$key + 1];
$element = $this->_elements[$key];
$isNextElementTable = $nextElement instanceof PHPRtfLite_Table;
if ($nextElement instanceof PHPRtfLite_List && $element instanceof PHPRtfLite_Element) {
return true;
}
if ($element instanceof PHPRtfLite_Table && $element->getNestDepth() == 1) {
return !$element->getPreventEmptyParagraph();
}
if ($element instanceof PHPRtfLite_Element) {
return (!$element->isEmptyParagraph() && ($isNextElementTable || $nextElement->getParFormat()));
}
if ($element instanceof PHPRtfLite_Image) {
return ($isNextElementTable || $nextElement->getParFormat());
}
if ($nextElement instanceof PHPRtfLite_List) {
return true;
}
}
return false;
} | php | private function needToAddParagraphEnd($key)
{
if (isset($this->_elements[$key + 1])) {
$nextElement = $this->_elements[$key + 1];
$element = $this->_elements[$key];
$isNextElementTable = $nextElement instanceof PHPRtfLite_Table;
if ($nextElement instanceof PHPRtfLite_List && $element instanceof PHPRtfLite_Element) {
return true;
}
if ($element instanceof PHPRtfLite_Table && $element->getNestDepth() == 1) {
return !$element->getPreventEmptyParagraph();
}
if ($element instanceof PHPRtfLite_Element) {
return (!$element->isEmptyParagraph() && ($isNextElementTable || $nextElement->getParFormat()));
}
if ($element instanceof PHPRtfLite_Image) {
return ($isNextElementTable || $nextElement->getParFormat());
}
if ($nextElement instanceof PHPRtfLite_List) {
return true;
}
}
return false;
} | [
"private",
"function",
"needToAddParagraphEnd",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_elements",
"[",
"$",
"key",
"+",
"1",
"]",
")",
")",
"{",
"$",
"nextElement",
"=",
"$",
"this",
"->",
"_elements",
"[",
"$",
"k... | checks, if a \par has to be added
@param integer $key
@return boolean | [
"checks",
"if",
"a",
"\\",
"par",
"has",
"to",
"be",
"added"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Base.php#L384-L409 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Element.php | PHPRtfLite_Element.convertTagsToRtf | public static function convertTagsToRtf($text, $charset)
{
$search = array(
// bold
'|<STRONG\s*>(.*?)</STRONG\s*>|smi',
'|<B\s*>(.*?)</B\s*>|smi',
// italic
'|<EM\s*>(.*?)</EM\s*>|smi',
'|<I\s*>(.*?)</I\s*>|smi',
// underline
'|<U\s*>(.*?)</U\s*>|smi',
// break
'|<BR\s*(/)?\s*>|smi',
'|<LINE\s*(/)?\s*>|smi',
// horizontal rule
'|<HR\s*(/)?\s*>|smi',
'|<CHDATE\s*(/)?\s*>|smi',
'|<CHDPL\s*(/)?\s*>|smi',
'|<CHDPA\s*(/)?\s*>|smi',
'|<CHTIME\s*(/)?\s*>|smi',
'|<CHPGN\s*(/)?\s*>|smi',
// tab
'|<TAB\s*(/)?\s*>|smi',
// bullet
'|<BULLET\s*(/)?\s*>|smi',
'|<PAGENUM\s*(/)?\s*>|smi',
'|<PAGETOTAL\s*(/)?\s*>|smi',
'|<SECTNUM\s*(/)?\s*>|smi',
'|<SUP\s*>(.*?)</SUP\s*>|smi',
'|<SUB\s*>(.*?)</SUB\s*>|smi',
// '|<PAGE\s*(/)?\s*>|smi',
// '|<SECT\s*(/)?\s*>|smi'
);
$replace = array(
// bold
'\b \1\b0 ',
'\b \1\b0 ',
// italic
'\i \1\i0 ',
'\i \1\i0 ',
// underline
'\ul \1\ul0 ',
// break
'\line ',
'\line ',
// horizontal rule
'{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}',
'\chdate ',
'\chdpl ',
'\chdpa ',
'\chtime ',
'\chpgn ',
// tab
'\tab ',
// bullet
'\bullet ',
'\chpgn ',
'{\field {\*\fldinst {NUMPAGES }}}',
'\sectnum ',
'{\super \1\super0}',
'{\sub \1\sub0}',
// '\page ',
// '\sect '
);
$text = preg_replace($search, $replace, $text);
$text = html_entity_decode($text, ENT_COMPAT, $charset);
return $text;
} | php | public static function convertTagsToRtf($text, $charset)
{
$search = array(
// bold
'|<STRONG\s*>(.*?)</STRONG\s*>|smi',
'|<B\s*>(.*?)</B\s*>|smi',
// italic
'|<EM\s*>(.*?)</EM\s*>|smi',
'|<I\s*>(.*?)</I\s*>|smi',
// underline
'|<U\s*>(.*?)</U\s*>|smi',
// break
'|<BR\s*(/)?\s*>|smi',
'|<LINE\s*(/)?\s*>|smi',
// horizontal rule
'|<HR\s*(/)?\s*>|smi',
'|<CHDATE\s*(/)?\s*>|smi',
'|<CHDPL\s*(/)?\s*>|smi',
'|<CHDPA\s*(/)?\s*>|smi',
'|<CHTIME\s*(/)?\s*>|smi',
'|<CHPGN\s*(/)?\s*>|smi',
// tab
'|<TAB\s*(/)?\s*>|smi',
// bullet
'|<BULLET\s*(/)?\s*>|smi',
'|<PAGENUM\s*(/)?\s*>|smi',
'|<PAGETOTAL\s*(/)?\s*>|smi',
'|<SECTNUM\s*(/)?\s*>|smi',
'|<SUP\s*>(.*?)</SUP\s*>|smi',
'|<SUB\s*>(.*?)</SUB\s*>|smi',
// '|<PAGE\s*(/)?\s*>|smi',
// '|<SECT\s*(/)?\s*>|smi'
);
$replace = array(
// bold
'\b \1\b0 ',
'\b \1\b0 ',
// italic
'\i \1\i0 ',
'\i \1\i0 ',
// underline
'\ul \1\ul0 ',
// break
'\line ',
'\line ',
// horizontal rule
'{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}',
'\chdate ',
'\chdpl ',
'\chdpa ',
'\chtime ',
'\chpgn ',
// tab
'\tab ',
// bullet
'\bullet ',
'\chpgn ',
'{\field {\*\fldinst {NUMPAGES }}}',
'\sectnum ',
'{\super \1\super0}',
'{\sub \1\sub0}',
// '\page ',
// '\sect '
);
$text = preg_replace($search, $replace, $text);
$text = html_entity_decode($text, ENT_COMPAT, $charset);
return $text;
} | [
"public",
"static",
"function",
"convertTagsToRtf",
"(",
"$",
"text",
",",
"$",
"charset",
")",
"{",
"$",
"search",
"=",
"array",
"(",
"// bold",
"'|<STRONG\\s*>(.*?)</STRONG\\s*>|smi'",
",",
"'|<B\\s*>(.*?)</B\\s*>|smi'",
",",
"// italic",
"'|<EM\\s*>(.*?)</EM\\s*>|smi... | converts text tags into rtf code
@param string $text
@param string $charset
@return string | [
"converts",
"text",
"tags",
"into",
"rtf",
"code"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Element.php#L151-L221 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Element.php | PHPRtfLite_Element.render | public function render()
{
$stream = $this->_rtf->getWriter();
$text = $this->_text;
if (!$this->_isRtfCode) {
$charset = $this->_rtf->getCharset();
$text = PHPRtfLite::quoteRtfCode($text);
if ($this->_convertTagsToRtf) {
$text = self::convertTagsToRtf($text, $charset);
}
$text = PHPRtfLite_Utf8::getUnicodeEntities($text, $charset);
}
$stream->write($this->getOpeningToken());
if ($this->_font) {
$stream->write($this->_font->getContent());
}
if (!$this->isEmptyParagraph() || $this->_isRtfCode) {
$stream->write($text);
}
$stream->write($this->getClosingToken() . "\r\n");
} | php | public function render()
{
$stream = $this->_rtf->getWriter();
$text = $this->_text;
if (!$this->_isRtfCode) {
$charset = $this->_rtf->getCharset();
$text = PHPRtfLite::quoteRtfCode($text);
if ($this->_convertTagsToRtf) {
$text = self::convertTagsToRtf($text, $charset);
}
$text = PHPRtfLite_Utf8::getUnicodeEntities($text, $charset);
}
$stream->write($this->getOpeningToken());
if ($this->_font) {
$stream->write($this->_font->getContent());
}
if (!$this->isEmptyParagraph() || $this->_isRtfCode) {
$stream->write($text);
}
$stream->write($this->getClosingToken() . "\r\n");
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_rtf",
"->",
"getWriter",
"(",
")",
";",
"$",
"text",
"=",
"$",
"this",
"->",
"_text",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_isRtfCode",
")",
"{",
"$",
"... | renders the element | [
"renders",
"the",
"element"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Element.php#L249-L273 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Unit.php | PHPRtfLite_Unit.convertTo | public static function convertTo($value, $unitFrom, $unitTo)
{
if ($unitTo == $unitFrom) {
return $value;
}
return ($value * $unitFrom) / $unitTo;
} | php | public static function convertTo($value, $unitFrom, $unitTo)
{
if ($unitTo == $unitFrom) {
return $value;
}
return ($value * $unitFrom) / $unitTo;
} | [
"public",
"static",
"function",
"convertTo",
"(",
"$",
"value",
",",
"$",
"unitFrom",
",",
"$",
"unitTo",
")",
"{",
"if",
"(",
"$",
"unitTo",
"==",
"$",
"unitFrom",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"(",
"$",
"value",
"*",
"$",
... | converts the value to another unit
@param float $value
@param float $unitFrom
@param float $unitTo
@return float | [
"converts",
"the",
"value",
"to",
"another",
"unit"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Unit.php#L99-L105 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/ColorTable.php | PHPRtfLite_DocHead_ColorTable.getColorAsFullHexCode | private static function getColorAsFullHexCode($color)
{
$color = ltrim($color, '#');
if (strlen($color) == 3) {
$color = str_repeat(substr($color, 0, 1), 2)
. str_repeat(substr($color, 1, 1), 2)
. str_repeat(substr($color, 2, 1), 2);
}
return strtoupper($color);
} | php | private static function getColorAsFullHexCode($color)
{
$color = ltrim($color, '#');
if (strlen($color) == 3) {
$color = str_repeat(substr($color, 0, 1), 2)
. str_repeat(substr($color, 1, 1), 2)
. str_repeat(substr($color, 2, 1), 2);
}
return strtoupper($color);
} | [
"private",
"static",
"function",
"getColorAsFullHexCode",
"(",
"$",
"color",
")",
"{",
"$",
"color",
"=",
"ltrim",
"(",
"$",
"color",
",",
"'#'",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"color",
")",
"==",
"3",
")",
"{",
"$",
"color",
"=",
"str_re... | gets color in hex code
@param string $color
@return string | [
"gets",
"color",
"in",
"hex",
"code"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/ColorTable.php#L47-L58 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/ColorTable.php | PHPRtfLite_DocHead_ColorTable.convertHexColorToRtf | private static function convertHexColorToRtf($color)
{
if (strlen($color) == 6) {
$red = hexdec(substr($color, 0, 2));
$green = hexdec(substr($color, 2, 2));
$blue = hexdec(substr($color, 4, 2));
return '\red' . $red . '\green' . $green . '\blue' . $blue;
}
throw new PHPRtfLite_Exception('Color must be a hex number of length 3 or 6 digits! You gave me: #' . $color);
} | php | private static function convertHexColorToRtf($color)
{
if (strlen($color) == 6) {
$red = hexdec(substr($color, 0, 2));
$green = hexdec(substr($color, 2, 2));
$blue = hexdec(substr($color, 4, 2));
return '\red' . $red . '\green' . $green . '\blue' . $blue;
}
throw new PHPRtfLite_Exception('Color must be a hex number of length 3 or 6 digits! You gave me: #' . $color);
} | [
"private",
"static",
"function",
"convertHexColorToRtf",
"(",
"$",
"color",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"color",
")",
"==",
"6",
")",
"{",
"$",
"red",
"=",
"hexdec",
"(",
"substr",
"(",
"$",
"color",
",",
"0",
",",
"2",
")",
")",
";"... | formats color code.
@param string $color Color
@return string rtf color
@throws PHPRtfLite_Exception, if color is not a 3or 6 digit hex number | [
"formats",
"color",
"code",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/ColorTable.php#L68-L79 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/ColorTable.php | PHPRtfLite_DocHead_ColorTable.add | public function add($color)
{
if (!empty($color)) {
$color = self::getColorAsFullHexCode($color);
if (!in_array($color, $this->_colors)) {
$this->_colors[] = $color;
}
}
} | php | public function add($color)
{
if (!empty($color)) {
$color = self::getColorAsFullHexCode($color);
if (!in_array($color, $this->_colors)) {
$this->_colors[] = $color;
}
}
} | [
"public",
"function",
"add",
"(",
"$",
"color",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"color",
")",
")",
"{",
"$",
"color",
"=",
"self",
"::",
"getColorAsFullHexCode",
"(",
"$",
"color",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"col... | adds color to rtf document
@param string $color color | [
"adds",
"color",
"to",
"rtf",
"document"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/ColorTable.php#L87-L95 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/ColorTable.php | PHPRtfLite_DocHead_ColorTable.getColorIndex | public function getColorIndex($color)
{
$color = self::getColorAsFullHexCode($color);
$index = array_search($color, $this->_colors);
return $index !== false ? $index + 1 : false;
} | php | public function getColorIndex($color)
{
$color = self::getColorAsFullHexCode($color);
$index = array_search($color, $this->_colors);
return $index !== false ? $index + 1 : false;
} | [
"public",
"function",
"getColorIndex",
"(",
"$",
"color",
")",
"{",
"$",
"color",
"=",
"self",
"::",
"getColorAsFullHexCode",
"(",
"$",
"color",
")",
";",
"$",
"index",
"=",
"array_search",
"(",
"$",
"color",
",",
"$",
"this",
"->",
"_colors",
")",
";"... | gets rtf code of color
@param string $color color
@return string | [
"gets",
"rtf",
"code",
"of",
"color"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/ColorTable.php#L104-L109 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/ColorTable.php | PHPRtfLite_DocHead_ColorTable.getContent | public function getContent()
{
$content = '{\colortbl;';
foreach ($this->_colors as $hexColor) {
$rtfColor = self::convertHexColorToRtf($hexColor);
$content .= $rtfColor . ';';
}
$content .= '}' . "\r\n";
return $content;
} | php | public function getContent()
{
$content = '{\colortbl;';
foreach ($this->_colors as $hexColor) {
$rtfColor = self::convertHexColorToRtf($hexColor);
$content .= $rtfColor . ';';
}
$content .= '}' . "\r\n";
return $content;
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"$",
"content",
"=",
"'{\\colortbl;'",
";",
"foreach",
"(",
"$",
"this",
"->",
"_colors",
"as",
"$",
"hexColor",
")",
"{",
"$",
"rtfColor",
"=",
"self",
"::",
"convertHexColorToRtf",
"(",
"$",
"hexColor",
... | gets rtf color table
@return string | [
"gets",
"rtf",
"color",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/ColorTable.php#L117-L129 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container.php | PHPRtfLite_Container.addFootnote | public function addFootnote($noteText, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$footnote = new PHPRtfLite_Footnote($this->_rtf, $noteText, $font, $parFormat);
$this->_elements[] = $footnote;
return $footnote;
} | php | public function addFootnote($noteText, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$footnote = new PHPRtfLite_Footnote($this->_rtf, $noteText, $font, $parFormat);
$this->_elements[] = $footnote;
return $footnote;
} | [
"public",
"function",
"addFootnote",
"(",
"$",
"noteText",
",",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
")",
"{",
"$",
"footnote",
"=",
"new",
"PHPRtfLite_Footnote",
"(",
"$",
"this",
"->",
"_r... | adds a footnote
@param string $noteText
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@return PHPRtfLite_Footnote | [
"adds",
"a",
"footnote"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container.php#L44-L49 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container.php | PHPRtfLite_Container.addEndnote | public function addEndnote($noteText, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$endnote = new PHPRtfLite_Endnote($this->_rtf, $noteText, $font, $parFormat);
$this->_elements[] = $endnote;
return $endnote;
} | php | public function addEndnote($noteText, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$endnote = new PHPRtfLite_Endnote($this->_rtf, $noteText, $font, $parFormat);
$this->_elements[] = $endnote;
return $endnote;
} | [
"public",
"function",
"addEndnote",
"(",
"$",
"noteText",
",",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
")",
"{",
"$",
"endnote",
"=",
"new",
"PHPRtfLite_Endnote",
"(",
"$",
"this",
"->",
"_rtf"... | adds an endnote
@param string $noteText
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@return PHPRtfLite_Endnote | [
"adds",
"an",
"endnote"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container.php#L61-L66 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container.php | PHPRtfLite_Container.addCheckbox | public function addCheckbox(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$checkBox = new PHPRtfLite_FormField_Checkbox($this->_rtf, $font, $parFormat);
$this->_elements[] = $checkBox;
return $checkBox;
} | php | public function addCheckbox(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$checkBox = new PHPRtfLite_FormField_Checkbox($this->_rtf, $font, $parFormat);
$this->_elements[] = $checkBox;
return $checkBox;
} | [
"public",
"function",
"addCheckbox",
"(",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
")",
"{",
"$",
"checkBox",
"=",
"new",
"PHPRtfLite_FormField_Checkbox",
"(",
"$",
"this",
"->",
"_rtf",
",",
"$",... | adds checkbox field
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@return PHPRtfLite_FormField_Checkbox | [
"adds",
"checkbox",
"field"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container.php#L109-L114 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container.php | PHPRtfLite_Container.addDropdown | public function addDropdown(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$dropdown = new PHPRtfLite_FormField_Dropdown($this->_rtf, $font, $parFormat);
$this->_elements[] = $dropdown;
return $dropdown;
} | php | public function addDropdown(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$dropdown = new PHPRtfLite_FormField_Dropdown($this->_rtf, $font, $parFormat);
$this->_elements[] = $dropdown;
return $dropdown;
} | [
"public",
"function",
"addDropdown",
"(",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
")",
"{",
"$",
"dropdown",
"=",
"new",
"PHPRtfLite_FormField_Dropdown",
"(",
"$",
"this",
"->",
"_rtf",
",",
"$",... | adds dropdown field
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@return PHPRtfLite_FormField_Dropdown | [
"adds",
"dropdown",
"field"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container.php#L124-L129 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container.php | PHPRtfLite_Container.addTextField | public function addTextField(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$textField = new PHPRtfLite_FormField_Text($this->_rtf, $font, $parFormat);
$this->_elements[] = $textField;
return $textField;
} | php | public function addTextField(PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null)
{
$textField = new PHPRtfLite_FormField_Text($this->_rtf, $font, $parFormat);
$this->_elements[] = $textField;
return $textField;
} | [
"public",
"function",
"addTextField",
"(",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
")",
"{",
"$",
"textField",
"=",
"new",
"PHPRtfLite_FormField_Text",
"(",
"$",
"this",
"->",
"_rtf",
",",
"$",
... | adds text field
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@return PHPRtfLite_FormField_Text | [
"adds",
"text",
"field"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container.php#L139-L144 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/FontTable.php | PHPRtfLite_DocHead_FontTable.add | public function add($fontFamily)
{
if (!empty($fontFamily)) {
if (!in_array($fontFamily, $this->_fontFamilies)) {
$this->_fontFamilies[] = $fontFamily;
}
}
} | php | public function add($fontFamily)
{
if (!empty($fontFamily)) {
if (!in_array($fontFamily, $this->_fontFamilies)) {
$this->_fontFamilies[] = $fontFamily;
}
}
} | [
"public",
"function",
"add",
"(",
"$",
"fontFamily",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"fontFamily",
")",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"fontFamily",
",",
"$",
"this",
"->",
"_fontFamilies",
")",
")",
"{",
"$",
"this",
... | adds font family to the font table
@param string $fontFamily | [
"adds",
"font",
"family",
"to",
"the",
"font",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/FontTable.php#L46-L53 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/DocHead/FontTable.php | PHPRtfLite_DocHead_FontTable.getContent | public function getContent()
{
$content = '{\fonttbl';
foreach ($this->_fontFamilies as $key => $value) {
$content .= '{\f' . $key . ' ' . $value . ';}';
}
$content .= '}' . "\r\n";
return $content;
} | php | public function getContent()
{
$content = '{\fonttbl';
foreach ($this->_fontFamilies as $key => $value) {
$content .= '{\f' . $key . ' ' . $value . ';}';
}
$content .= '}' . "\r\n";
return $content;
} | [
"public",
"function",
"getContent",
"(",
")",
"{",
"$",
"content",
"=",
"'{\\fonttbl'",
";",
"foreach",
"(",
"$",
"this",
"->",
"_fontFamilies",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"content",
".=",
"'{\\f'",
".",
"$",
"key",
".",
"' ... | gets rtf font table
@return string | [
"gets",
"rtf",
"font",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/DocHead/FontTable.php#L73-L84 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.addTable | public function addTable($alignment = PHPRtfLite_Table::ALIGN_LEFT)
{
$nestDepth = $this->_table->getNestDepth() + 1;
$table = new PHPRtfLite_Table_Nested($this, $alignment, $nestDepth);
$this->_elements[] = $table;
return $table;
} | php | public function addTable($alignment = PHPRtfLite_Table::ALIGN_LEFT)
{
$nestDepth = $this->_table->getNestDepth() + 1;
$table = new PHPRtfLite_Table_Nested($this, $alignment, $nestDepth);
$this->_elements[] = $table;
return $table;
} | [
"public",
"function",
"addTable",
"(",
"$",
"alignment",
"=",
"PHPRtfLite_Table",
"::",
"ALIGN_LEFT",
")",
"{",
"$",
"nestDepth",
"=",
"$",
"this",
"->",
"_table",
"->",
"getNestDepth",
"(",
")",
"+",
"1",
";",
"$",
"table",
"=",
"new",
"PHPRtfLite_Table_N... | adds nested table
@param string $alignment
@return PHPRtfLite_Table_Nested | [
"adds",
"nested",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L201-L208 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.getWidth | public function getWidth()
{
if ($this->_width) {
return $this->_width;
}
return $this->_table->getColumn($this->_columnIndex)->getWidth();
} | php | public function getWidth()
{
if ($this->_width) {
return $this->_width;
}
return $this->_table->getColumn($this->_columnIndex)->getWidth();
} | [
"public",
"function",
"getWidth",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_width",
")",
"{",
"return",
"$",
"this",
"->",
"_width",
";",
"}",
"return",
"$",
"this",
"->",
"_table",
"->",
"getColumn",
"(",
"$",
"this",
"->",
"_columnIndex",
")",... | gets cell width
@return float | [
"gets",
"cell",
"width"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L425-L431 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.getBorderForCell | protected function getBorderForCell($rowIndex, $columnIndex)
{
$cell = $this->_table->getCell($rowIndex, $columnIndex);
$border = $cell->getBorder();
if ($border === null) {
$border = new PHPRtfLite_Border($this->_rtf);
$cell->setCellBorder($border);
}
return $border;
} | php | protected function getBorderForCell($rowIndex, $columnIndex)
{
$cell = $this->_table->getCell($rowIndex, $columnIndex);
$border = $cell->getBorder();
if ($border === null) {
$border = new PHPRtfLite_Border($this->_rtf);
$cell->setCellBorder($border);
}
return $border;
} | [
"protected",
"function",
"getBorderForCell",
"(",
"$",
"rowIndex",
",",
"$",
"columnIndex",
")",
"{",
"$",
"cell",
"=",
"$",
"this",
"->",
"_table",
"->",
"getCell",
"(",
"$",
"rowIndex",
",",
"$",
"columnIndex",
")",
";",
"$",
"border",
"=",
"$",
"cel... | gets border for specific cell
@param integer $rowIndex
@param integer $columnIndex
@return PHPRtfLite_Border | [
"gets",
"border",
"for",
"specific",
"cell"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L441-L451 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.setBorder | public function setBorder(PHPRtfLite_Border $border)
{
$borderFormatTop = $border->getBorderTop();
$borderFormatBottom = $border->getBorderBottom();
$borderFormatLeft = $border->getBorderLeft();
$borderFormatRight = $border->getBorderRight();
if ($this->_border === null) {
$this->_border = new PHPRtfLite_Border($this->_rtf);
}
if ($borderFormatLeft) {
$this->_border->setBorderLeft($borderFormatLeft);
}
if ($borderFormatRight) {
$this->_border->setBorderRight($borderFormatRight);
}
if ($borderFormatTop) {
$this->_border->setBorderTop($borderFormatTop);
}
if ($borderFormatBottom) {
$this->_border->setBorderBottom($borderFormatBottom);
}
if ($borderFormatTop && $this->_table->checkIfCellExists($this->_rowIndex - 1, $this->_columnIndex)) {
$this->getBorderForCell($this->_rowIndex - 1, $this->_columnIndex)->setBorderBottom($borderFormatTop);
}
if ($borderFormatBottom && $this->_table->checkIfCellExists($this->_rowIndex + 1, $this->_columnIndex)) {
$this->getBorderForCell($this->_rowIndex + 1, $this->_columnIndex)->setBorderTop($borderFormatBottom);
}
if ($borderFormatLeft && $this->_table->checkIfCellExists($this->_rowIndex, $this->_columnIndex - 1)) {
$this->getBorderForCell($this->_rowIndex, $this->_columnIndex - 1)->setBorderRight($borderFormatLeft);
}
if ($borderFormatRight && $this->_table->checkIfCellExists($this->_rowIndex, $this->_columnIndex + 1)) {
$this->getBorderForCell($this->_rowIndex, $this->_columnIndex + 1)->setBorderLeft($borderFormatRight);
}
} | php | public function setBorder(PHPRtfLite_Border $border)
{
$borderFormatTop = $border->getBorderTop();
$borderFormatBottom = $border->getBorderBottom();
$borderFormatLeft = $border->getBorderLeft();
$borderFormatRight = $border->getBorderRight();
if ($this->_border === null) {
$this->_border = new PHPRtfLite_Border($this->_rtf);
}
if ($borderFormatLeft) {
$this->_border->setBorderLeft($borderFormatLeft);
}
if ($borderFormatRight) {
$this->_border->setBorderRight($borderFormatRight);
}
if ($borderFormatTop) {
$this->_border->setBorderTop($borderFormatTop);
}
if ($borderFormatBottom) {
$this->_border->setBorderBottom($borderFormatBottom);
}
if ($borderFormatTop && $this->_table->checkIfCellExists($this->_rowIndex - 1, $this->_columnIndex)) {
$this->getBorderForCell($this->_rowIndex - 1, $this->_columnIndex)->setBorderBottom($borderFormatTop);
}
if ($borderFormatBottom && $this->_table->checkIfCellExists($this->_rowIndex + 1, $this->_columnIndex)) {
$this->getBorderForCell($this->_rowIndex + 1, $this->_columnIndex)->setBorderTop($borderFormatBottom);
}
if ($borderFormatLeft && $this->_table->checkIfCellExists($this->_rowIndex, $this->_columnIndex - 1)) {
$this->getBorderForCell($this->_rowIndex, $this->_columnIndex - 1)->setBorderRight($borderFormatLeft);
}
if ($borderFormatRight && $this->_table->checkIfCellExists($this->_rowIndex, $this->_columnIndex + 1)) {
$this->getBorderForCell($this->_rowIndex, $this->_columnIndex + 1)->setBorderLeft($borderFormatRight);
}
} | [
"public",
"function",
"setBorder",
"(",
"PHPRtfLite_Border",
"$",
"border",
")",
"{",
"$",
"borderFormatTop",
"=",
"$",
"border",
"->",
"getBorderTop",
"(",
")",
";",
"$",
"borderFormatBottom",
"=",
"$",
"border",
"->",
"getBorderBottom",
"(",
")",
";",
"$",... | sets border to a cell
@param PHPRtfLite_Border $border | [
"sets",
"border",
"to",
"a",
"cell"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L459-L497 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.setCellPaddings | public function setCellPaddings($paddingLeft, $paddingTop, $paddingRight, $paddingBottom)
{
$this->_paddingLeft = $paddingLeft;
$this->_paddingTop = $paddingTop;
$this->_paddingRight = $paddingRight;
$this->_paddingBottom = $paddingBottom;
} | php | public function setCellPaddings($paddingLeft, $paddingTop, $paddingRight, $paddingBottom)
{
$this->_paddingLeft = $paddingLeft;
$this->_paddingTop = $paddingTop;
$this->_paddingRight = $paddingRight;
$this->_paddingBottom = $paddingBottom;
} | [
"public",
"function",
"setCellPaddings",
"(",
"$",
"paddingLeft",
",",
"$",
"paddingTop",
",",
"$",
"paddingRight",
",",
"$",
"paddingBottom",
")",
"{",
"$",
"this",
"->",
"_paddingLeft",
"=",
"$",
"paddingLeft",
";",
"$",
"this",
"->",
"_paddingTop",
"=",
... | sets cell paddings
@param integer $paddingLeft
@param integer $paddingTop
@param integer $paddingRight
@param integer $paddingBottom | [
"sets",
"cell",
"paddings"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L552-L558 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.renderDefinition | public function renderDefinition()
{
$stream = $this->_rtf->getWriter();
if ($this->isVerticalMerged()) {
if ($this->isVerticalMergedFirstInRange()) {
$stream->write('\clvmgf');
}
else {
$stream->write('\clvmrg');
}
}
$backgroundColor = $this->getBackgroundColor();
if ($backgroundColor) {
$colorTable = $this->_rtf->getColorTable();
$stream->write('\clcbpat' . $colorTable->getColorIndex($backgroundColor) . ' ');
}
switch ($this->getVerticalAlignment()) {
case self::VERTICAL_ALIGN_TOP:
$stream->write('\clvertalt');
break;
case self::VERTICAL_ALIGN_CENTER:
$stream->write('\clvertalc');
break;
case self::VERTICAL_ALIGN_BOTTOM:
$stream->write('\clvertalb');
break;
}
switch ($this->getRotateTo()) {
case self::ROTATE_RIGHT:
$stream->write('\cltxtbrl');
break;
case self::ROTATE_LEFT:
$stream->write('\cltxbtlr');
break;
}
// NOTE: microsoft and all other rtf readers I know confound left with top cell padding
if ($this->_paddingLeft) {
$stream->write('\clpadft3\clpadt' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingLeft) . ' ');
}
if ($this->_paddingTop) {
$stream->write('\clpadfl3\clpadl' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingTop) . ' ');
}
if ($this->_paddingBottom) {
$stream->write('\clpadfb3\clpadb' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingBottom) . ' ');
}
if ($this->_paddingRight) {
$stream->write('\clpadfr3\clpadr' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingRight) . ' ');
}
$border = $this->getBorder();
if ($border) {
$stream->write($border->getContent('\cl'));
}
} | php | public function renderDefinition()
{
$stream = $this->_rtf->getWriter();
if ($this->isVerticalMerged()) {
if ($this->isVerticalMergedFirstInRange()) {
$stream->write('\clvmgf');
}
else {
$stream->write('\clvmrg');
}
}
$backgroundColor = $this->getBackgroundColor();
if ($backgroundColor) {
$colorTable = $this->_rtf->getColorTable();
$stream->write('\clcbpat' . $colorTable->getColorIndex($backgroundColor) . ' ');
}
switch ($this->getVerticalAlignment()) {
case self::VERTICAL_ALIGN_TOP:
$stream->write('\clvertalt');
break;
case self::VERTICAL_ALIGN_CENTER:
$stream->write('\clvertalc');
break;
case self::VERTICAL_ALIGN_BOTTOM:
$stream->write('\clvertalb');
break;
}
switch ($this->getRotateTo()) {
case self::ROTATE_RIGHT:
$stream->write('\cltxtbrl');
break;
case self::ROTATE_LEFT:
$stream->write('\cltxbtlr');
break;
}
// NOTE: microsoft and all other rtf readers I know confound left with top cell padding
if ($this->_paddingLeft) {
$stream->write('\clpadft3\clpadt' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingLeft) . ' ');
}
if ($this->_paddingTop) {
$stream->write('\clpadfl3\clpadl' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingTop) . ' ');
}
if ($this->_paddingBottom) {
$stream->write('\clpadfb3\clpadb' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingBottom) . ' ');
}
if ($this->_paddingRight) {
$stream->write('\clpadfr3\clpadr' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingRight) . ' ');
}
$border = $this->getBorder();
if ($border) {
$stream->write($border->getContent('\cl'));
}
} | [
"public",
"function",
"renderDefinition",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_rtf",
"->",
"getWriter",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isVerticalMerged",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isVerticalM... | renders cell definition | [
"renders",
"cell",
"definition"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L608-L668 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Cell.php | PHPRtfLite_Table_Cell.render | public function render()
{
$stream = $this->_rtf->getWriter();
$stream->write("\r\n");
// renders container elements
parent::render();
$containerElements = $this->getElements();
$numOfContainerElements = count($containerElements);
if ($this->_table->isNestedTable()) {
// if last container element is not a nested table, close cell
if ($numOfContainerElements == 0
|| !($containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested))
{
$stream->write('{\nestcell{\nonesttables\par}\pard}' . "\r\n");
// if last cell of row, close row
if ($this->getColumnIndex() == $this->_table->getColumnsCount()) {
$stream->write('{\*\nesttableprops ');
$row = $this->_table->getRow($this->_rowIndex);
$this->_table->renderRowDefinition($row);
$stream->write('\nestrow}');
}
}
}
else {
if ($numOfContainerElements > 0
&& $containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested)
{
$stream->write('\intbl\itap1\~');
}
// closing tag for cell definition
$stream->write('\cell');
}
$stream->write("\r\n");
} | php | public function render()
{
$stream = $this->_rtf->getWriter();
$stream->write("\r\n");
// renders container elements
parent::render();
$containerElements = $this->getElements();
$numOfContainerElements = count($containerElements);
if ($this->_table->isNestedTable()) {
// if last container element is not a nested table, close cell
if ($numOfContainerElements == 0
|| !($containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested))
{
$stream->write('{\nestcell{\nonesttables\par}\pard}' . "\r\n");
// if last cell of row, close row
if ($this->getColumnIndex() == $this->_table->getColumnsCount()) {
$stream->write('{\*\nesttableprops ');
$row = $this->_table->getRow($this->_rowIndex);
$this->_table->renderRowDefinition($row);
$stream->write('\nestrow}');
}
}
}
else {
if ($numOfContainerElements > 0
&& $containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested)
{
$stream->write('\intbl\itap1\~');
}
// closing tag for cell definition
$stream->write('\cell');
}
$stream->write("\r\n");
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_rtf",
"->",
"getWriter",
"(",
")",
";",
"$",
"stream",
"->",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"// renders container elements",
"parent",
"::",
"render",
"(",
")"... | renders rtf code for cell | [
"renders",
"rtf",
"code",
"for",
"cell"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Cell.php#L674-L711 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Row.php | PHPRtfLite_Table_Row.getCellByIndex | public function getCellByIndex($columnIndex)
{
if (!isset($this->_cells[$columnIndex - 1])) {
$this->_cells[$columnIndex - 1] = new PHPRtfLite_Table_Cell($this->_table, $this->_rowIndex, $columnIndex);
}
return $this->_cells[$columnIndex - 1];
} | php | public function getCellByIndex($columnIndex)
{
if (!isset($this->_cells[$columnIndex - 1])) {
$this->_cells[$columnIndex - 1] = new PHPRtfLite_Table_Cell($this->_table, $this->_rowIndex, $columnIndex);
}
return $this->_cells[$columnIndex - 1];
} | [
"public",
"function",
"getCellByIndex",
"(",
"$",
"columnIndex",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_cells",
"[",
"$",
"columnIndex",
"-",
"1",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_cells",
"[",
"$",
"columnIndex",
"-",
... | Gets cell instance for the given column index
@param integer $columnIndex
@return PHPRtfLite_Table_Cell | [
"Gets",
"cell",
"instance",
"for",
"the",
"given",
"column",
"index"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Row.php#L101-L108 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Section.php | PHPRtfLite_Container_Section.setMargins | public function setMargins($marginLeft, $marginTop, $marginRight, $marginBottom)
{
$this->_marginLeft = $marginLeft;
$this->_marginTop = $marginTop;
$this->_marginRight = $marginRight;
$this->_marginBottom = $marginBottom;
} | php | public function setMargins($marginLeft, $marginTop, $marginRight, $marginBottom)
{
$this->_marginLeft = $marginLeft;
$this->_marginTop = $marginTop;
$this->_marginRight = $marginRight;
$this->_marginBottom = $marginBottom;
} | [
"public",
"function",
"setMargins",
"(",
"$",
"marginLeft",
",",
"$",
"marginTop",
",",
"$",
"marginRight",
",",
"$",
"marginBottom",
")",
"{",
"$",
"this",
"->",
"_marginLeft",
"=",
"$",
"marginLeft",
";",
"$",
"this",
"->",
"_marginTop",
"=",
"$",
"mar... | sets the margins of pages in section.
@param float $marginLeft Margin left
@param float $marginTop Margin top
@param float $marginRight Margin right
@param float $marginBottom Margin bottom | [
"sets",
"the",
"margins",
"of",
"pages",
"in",
"section",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Section.php#L225-L231 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Section.php | PHPRtfLite_Container_Section.getLayoutWidth | public function getLayoutWidth()
{
$paperWidth = $this->_paperWidth !== null ? $this->_paperWidth : $this->_rtf->getPaperWidth();
$marginLeft = $this->_marginLeft !== null ? $this->_marginLeft : $this->_rtf->getMarginLeft();
$marginRight = $this->_marginRight !== null ? $this->_marginRight : $this->_rtf->getMarginRight();
$layoutWidth = $paperWidth - $marginLeft - $marginRight;
if ($layoutWidth <= 0) {
throw new PHPRtfLite_Exception('The paper layout width is lower or equal zero!');
}
return $layoutWidth;
} | php | public function getLayoutWidth()
{
$paperWidth = $this->_paperWidth !== null ? $this->_paperWidth : $this->_rtf->getPaperWidth();
$marginLeft = $this->_marginLeft !== null ? $this->_marginLeft : $this->_rtf->getMarginLeft();
$marginRight = $this->_marginRight !== null ? $this->_marginRight : $this->_rtf->getMarginRight();
$layoutWidth = $paperWidth - $marginLeft - $marginRight;
if ($layoutWidth <= 0) {
throw new PHPRtfLite_Exception('The paper layout width is lower or equal zero!');
}
return $layoutWidth;
} | [
"public",
"function",
"getLayoutWidth",
"(",
")",
"{",
"$",
"paperWidth",
"=",
"$",
"this",
"->",
"_paperWidth",
"!==",
"null",
"?",
"$",
"this",
"->",
"_paperWidth",
":",
"$",
"this",
"->",
"_rtf",
"->",
"getPaperWidth",
"(",
")",
";",
"$",
"marginLeft"... | gets width of page layout
@return float
@throws PHPRtfLite_Exception thrown if paper layout width is lower or equal 0 | [
"gets",
"width",
"of",
"page",
"layout"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Section.php#L372-L384 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Section.php | PHPRtfLite_Container_Section.setBorders | public function setBorders(PHPRtfLite_Border_Format $borderFormat,
$left = true, $top = true,
$right = true, $bottom = true)
{
if ($this->_border === null) {
$this->_border = new PHPRtfLite_Border($this->_rtf);
}
$this->_border->setBorders($borderFormat, $left, $top, $right, $bottom);
} | php | public function setBorders(PHPRtfLite_Border_Format $borderFormat,
$left = true, $top = true,
$right = true, $bottom = true)
{
if ($this->_border === null) {
$this->_border = new PHPRtfLite_Border($this->_rtf);
}
$this->_border->setBorders($borderFormat, $left, $top, $right, $bottom);
} | [
"public",
"function",
"setBorders",
"(",
"PHPRtfLite_Border_Format",
"$",
"borderFormat",
",",
"$",
"left",
"=",
"true",
",",
"$",
"top",
"=",
"true",
",",
"$",
"right",
"=",
"true",
",",
"$",
"bottom",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
... | sets borders to rtf document.
@param PHPRtfLite_Border_Format $borderFormat
@param boolean $left
@param boolean $top
@param boolean $right
@param boolean $bottom | [
"sets",
"borders",
"to",
"rtf",
"document",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Section.php#L418-L426 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Section.php | PHPRtfLite_Container_Section.addHeader | public function addHeader($type = PHPRtfLite_Container_Header::TYPE_ALL)
{
$header = new PHPRtfLite_Container_Header($this->_rtf, $type);
$this->_headers[$type] = $header;
return $header;
} | php | public function addHeader($type = PHPRtfLite_Container_Header::TYPE_ALL)
{
$header = new PHPRtfLite_Container_Header($this->_rtf, $type);
$this->_headers[$type] = $header;
return $header;
} | [
"public",
"function",
"addHeader",
"(",
"$",
"type",
"=",
"PHPRtfLite_Container_Header",
"::",
"TYPE_ALL",
")",
"{",
"$",
"header",
"=",
"new",
"PHPRtfLite_Container_Header",
"(",
"$",
"this",
"->",
"_rtf",
",",
"$",
"type",
")",
";",
"$",
"this",
"->",
"_... | creates header for sections.
@param string $type Represented by class constants PHPRtfLite_Container_Header::TYPE_*
Possible values: <br>
PHPRtfLite_Container_Header::TYPE_ALL => 'all' - all pages (different odd and even headers/footers must be not set) <br>
PHPRtfLite_Container_Header::TYPE_LEFT => 'left' - left pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Header::TYPE_RIGHT => 'right' - right pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Header::TYPE_FIRST => 'first' - first page
@return PHPRtfLite_Container_Header | [
"creates",
"header",
"for",
"sections",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Section.php#L555-L561 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Container/Section.php | PHPRtfLite_Container_Section.addFooter | public function addFooter($type = PHPRtfLite_Container_Footer::TYPE_ALL)
{
$footer = new PHPRtfLite_Container_Footer($this->_rtf, $type);
$this->_footers[$type] = $footer;
return $footer;
} | php | public function addFooter($type = PHPRtfLite_Container_Footer::TYPE_ALL)
{
$footer = new PHPRtfLite_Container_Footer($this->_rtf, $type);
$this->_footers[$type] = $footer;
return $footer;
} | [
"public",
"function",
"addFooter",
"(",
"$",
"type",
"=",
"PHPRtfLite_Container_Footer",
"::",
"TYPE_ALL",
")",
"{",
"$",
"footer",
"=",
"new",
"PHPRtfLite_Container_Footer",
"(",
"$",
"this",
"->",
"_rtf",
",",
"$",
"type",
")",
";",
"$",
"this",
"->",
"_... | creates footer for the document.
@param string $type Represented by class constants PHPRtfLite_Container_Footer::TYPE_*
PHPRtfLite_Container_Footer::TYPE_ALL => 'all' - all pages (different odd and even headers/footers must be not set) <br>
PHPRtfLite_Container_Footer::TYPE_LEFT => 'left' - left pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Footer::TYPE_RIGHT => 'right' - right pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Footer::TYPE_FIRST => 'first' - first page
@return PHPRtfLite_Container_Footer | [
"creates",
"footer",
"for",
"the",
"document",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Container/Section.php#L586-L592 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/FormField.php | PHPRtfLite_FormField.render | public function render()
{
$stream = $this->_rtf->getWriter();
$stream->write(' ');
if ($this->_font) {
$stream->write('{' . $this->_font->getContent());
}
$defaultValue = PHPRtfLite_Utf8::getUnicodeEntities($this->_defaultValue, $this->_rtf->getCharset());
$content = '{\field'
. '{\*\fldinst ' . $this->getType()
. ' {\*\formfield' . $this->getRtfCode() . '}'
. '}{\fldrslt ' . $defaultValue . '}}';
$stream->write($content);
if ($this->_font) {
$stream->write($this->_font->getClosingContent() . '}');
}
$stream->write(' ');
} | php | public function render()
{
$stream = $this->_rtf->getWriter();
$stream->write(' ');
if ($this->_font) {
$stream->write('{' . $this->_font->getContent());
}
$defaultValue = PHPRtfLite_Utf8::getUnicodeEntities($this->_defaultValue, $this->_rtf->getCharset());
$content = '{\field'
. '{\*\fldinst ' . $this->getType()
. ' {\*\formfield' . $this->getRtfCode() . '}'
. '}{\fldrslt ' . $defaultValue . '}}';
$stream->write($content);
if ($this->_font) {
$stream->write($this->_font->getClosingContent() . '}');
}
$stream->write(' ');
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_rtf",
"->",
"getWriter",
"(",
")",
";",
"$",
"stream",
"->",
"write",
"(",
"' '",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_font",
")",
"{",
"$",
"stream",
... | renders form field | [
"renders",
"form",
"field"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/FormField.php#L128-L149 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/List/Numbering.php | PHPRtfLite_List_Numbering.getAlphaNumber | private function getAlphaNumber($number, $lowerCase = false)
{
$asciiStartIndex = $lowerCase ? 97 : 65;
$alpha = '';
while ($number > 0) {
$modulus = ($number - 1) % 26;
$alpha .= chr($modulus + $asciiStartIndex);
$number = floor(($number - 1) / 26);
}
return strrev($alpha);
} | php | private function getAlphaNumber($number, $lowerCase = false)
{
$asciiStartIndex = $lowerCase ? 97 : 65;
$alpha = '';
while ($number > 0) {
$modulus = ($number - 1) % 26;
$alpha .= chr($modulus + $asciiStartIndex);
$number = floor(($number - 1) / 26);
}
return strrev($alpha);
} | [
"private",
"function",
"getAlphaNumber",
"(",
"$",
"number",
",",
"$",
"lowerCase",
"=",
"false",
")",
"{",
"$",
"asciiStartIndex",
"=",
"$",
"lowerCase",
"?",
"97",
":",
"65",
";",
"$",
"alpha",
"=",
"''",
";",
"while",
"(",
"$",
"number",
">",
"0",... | gets alpha number
@param integer $number
@param boolean $lowerCase
@return string | [
"gets",
"alpha",
"number"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/List/Numbering.php#L131-L141 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/List/Numbering.php | PHPRtfLite_List_Numbering.getListCharacter | protected function getListCharacter($number)
{
$listCharacter = $this->_prefix . $this->getNumber($number) . $this->_suffix;
return PHPRtfLite::quoteRtfCode($listCharacter);
} | php | protected function getListCharacter($number)
{
$listCharacter = $this->_prefix . $this->getNumber($number) . $this->_suffix;
return PHPRtfLite::quoteRtfCode($listCharacter);
} | [
"protected",
"function",
"getListCharacter",
"(",
"$",
"number",
")",
"{",
"$",
"listCharacter",
"=",
"$",
"this",
"->",
"_prefix",
".",
"$",
"this",
"->",
"getNumber",
"(",
"$",
"number",
")",
".",
"$",
"this",
"->",
"_suffix",
";",
"return",
"PHPRtfLit... | gets list character
@param integer $number
@return string | [
"gets",
"list",
"character"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/List/Numbering.php#L211-L215 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/List/Enumeration.php | PHPRtfLite_List_Enumeration.initListCharDefinition | protected function initListCharDefinition()
{
switch ($this->_type) {
case self::TYPE_ARROW:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Wingdings');
$this->_listChar = '\\\'d8';
break;
case self::TYPE_CIRCLE:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Courier New');
$this->_listChar = ' o';
break;
case self::TYPE_DIAMOND:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Wingdings');
$this->_listChar = ' v';
break;
case self::TYPE_SQUARE:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Wingdings');
$this->_listChar = '\\\'a7';
break;
// default is bullet
default:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Symbol');
$this->_listChar = '\\\'B7';
}
$this->_rtf->registerFont($this->_listCharFont);
} | php | protected function initListCharDefinition()
{
switch ($this->_type) {
case self::TYPE_ARROW:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Wingdings');
$this->_listChar = '\\\'d8';
break;
case self::TYPE_CIRCLE:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Courier New');
$this->_listChar = ' o';
break;
case self::TYPE_DIAMOND:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Wingdings');
$this->_listChar = ' v';
break;
case self::TYPE_SQUARE:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Wingdings');
$this->_listChar = '\\\'a7';
break;
// default is bullet
default:
$this->_listCharFont = new PHPRtfLite_Font(10, 'Symbol');
$this->_listChar = '\\\'B7';
}
$this->_rtf->registerFont($this->_listCharFont);
} | [
"protected",
"function",
"initListCharDefinition",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"_type",
")",
"{",
"case",
"self",
"::",
"TYPE_ARROW",
":",
"$",
"this",
"->",
"_listCharFont",
"=",
"new",
"PHPRtfLite_Font",
"(",
"10",
",",
"'Wingdings'",
... | inits list character definition | [
"inits",
"list",
"character",
"definition"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/List/Enumeration.php#L77-L103 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/List.php | PHPRtfLite_List.addItem | public function addItem($text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true
) {
if ($font === null) {
$font = $this->_font;
}
if ($parFormat === null) {
$parFormat = $this->_parFormat;
}
$element = new PHPRtfLite_Element($this->_rtf, $text, $font, $parFormat);
if ($convertTagsToRtf) {
$element->setConvertTagsToRtf();
}
$this->_items[] = $element;
return $this;
} | php | public function addItem($text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true
) {
if ($font === null) {
$font = $this->_font;
}
if ($parFormat === null) {
$parFormat = $this->_parFormat;
}
$element = new PHPRtfLite_Element($this->_rtf, $text, $font, $parFormat);
if ($convertTagsToRtf) {
$element->setConvertTagsToRtf();
}
$this->_items[] = $element;
return $this;
} | [
"public",
"function",
"addItem",
"(",
"$",
"text",
",",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
",",
"$",
"convertTagsToRtf",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"font",
"===",
"null",
"... | adds item to list
@param string $text
@param PHPRtfLite_Font $font
@param PHPRtfLite_ParFormat $parFormat
@param boolean $convertTagsToRtf
@return $this | [
"adds",
"item",
"to",
"list"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/List.php#L113-L132 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/List.php | PHPRtfLite_List.addList | public function addList(PHPRtfLite_List $list)
{
$this->_items[] = $list;
$list->_textIndent += $this->_textIndent;
return $this;
} | php | public function addList(PHPRtfLite_List $list)
{
$this->_items[] = $list;
$list->_textIndent += $this->_textIndent;
return $this;
} | [
"public",
"function",
"addList",
"(",
"PHPRtfLite_List",
"$",
"list",
")",
"{",
"$",
"this",
"->",
"_items",
"[",
"]",
"=",
"$",
"list",
";",
"$",
"list",
"->",
"_textIndent",
"+=",
"$",
"this",
"->",
"_textIndent",
";",
"return",
"$",
"this",
";",
"... | adds list to list
@param PHPRtfLite_List $list
@return $this | [
"adds",
"list",
"to",
"list"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/List.php#L154-L159 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/StreamOutput.php | PHPRtfLite_StreamOutput.open | public function open()
{
if ($this->_handle !== null) {
return;
}
$this->_handle = fopen($this->_filename, 'wr', false);
if (!$this->_handle) {
throw new PHPRtfLite_Exception("Could not open rtf output stream (url: $this->_filename)!");
}
flock($this->_handle, LOCK_EX);
} | php | public function open()
{
if ($this->_handle !== null) {
return;
}
$this->_handle = fopen($this->_filename, 'wr', false);
if (!$this->_handle) {
throw new PHPRtfLite_Exception("Could not open rtf output stream (url: $this->_filename)!");
}
flock($this->_handle, LOCK_EX);
} | [
"public",
"function",
"open",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_handle",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"_handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"_filename",
",",
"'wr'",
",",
"false",
")",
";... | opens file stream | [
"opens",
"file",
"stream"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/StreamOutput.php#L71-L82 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/StreamOutput.php | PHPRtfLite_StreamOutput.close | public function close()
{
if ($this->_handle !== null) {
fclose($this->_handle);
$this->_handle = null;
}
} | php | public function close()
{
if ($this->_handle !== null) {
fclose($this->_handle);
$this->_handle = null;
}
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_handle",
"!==",
"null",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"_handle",
")",
";",
"$",
"this",
"->",
"_handle",
"=",
"null",
";",
"}",
"}"
] | closes file handler | [
"closes",
"file",
"handler"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/StreamOutput.php#L88-L94 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/StreamOutput.php | PHPRtfLite_StreamOutput.write | public function write($data)
{
if ($this->_handle === null) {
throw new PHPRtfLite_Exception('Can not write on an undefined handle! Forgot to call open()?');
}
fwrite($this->_handle, $data);
} | php | public function write($data)
{
if ($this->_handle === null) {
throw new PHPRtfLite_Exception('Can not write on an undefined handle! Forgot to call open()?');
}
fwrite($this->_handle, $data);
} | [
"public",
"function",
"write",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_handle",
"===",
"null",
")",
"{",
"throw",
"new",
"PHPRtfLite_Exception",
"(",
"'Can not write on an undefined handle! Forgot to call open()?'",
")",
";",
"}",
"fwrite",
"... | writes string to file handler
@param string $data
@throws PHPRtfLite_Exception | [
"writes",
"string",
"to",
"file",
"handler"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/StreamOutput.php#L103-L109 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image/Wmf.php | PHPRtfLite_Image_Wmf.getHeaderSize | private function getHeaderSize()
{
// reset stream pointer to 0
fseek($this->_stream, 0);
// check for Aldus placeable metafile header
// L: vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge maschinenabhängig)
// magic:
$magic = fread($this->_stream, 4);
$headerSize = 18; // WMF header
if ($magic == "\xd7\xcd\xc6\x9a") {
$this->_headerStartBytesFound = true;
$headerSize += 22; // Aldus header
}
return $headerSize;
} | php | private function getHeaderSize()
{
// reset stream pointer to 0
fseek($this->_stream, 0);
// check for Aldus placeable metafile header
// L: vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge maschinenabhängig)
// magic:
$magic = fread($this->_stream, 4);
$headerSize = 18; // WMF header
if ($magic == "\xd7\xcd\xc6\x9a") {
$this->_headerStartBytesFound = true;
$headerSize += 22; // Aldus header
}
return $headerSize;
} | [
"private",
"function",
"getHeaderSize",
"(",
")",
"{",
"// reset stream pointer to 0",
"fseek",
"(",
"$",
"this",
"->",
"_stream",
",",
"0",
")",
";",
"// check for Aldus placeable metafile header",
"// L: vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge maschinenabhängig)",
... | Get header size of wmf.
@return integer $headerSize | [
"Get",
"header",
"size",
"of",
"wmf",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image/Wmf.php#L108-L122 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/FormField/Dropdown.php | PHPRtfLite_FormField_Dropdown.getRtfCode | public function getRtfCode()
{
$content = '{\fftype2\ffres25\fftypetxt0\ffhaslistbox\ffdefres0';
foreach ($this->_items as $text) {
$text = PHPRtfLite_Utf8::getUnicodeEntities($text, $this->_rtf->getCharset());
$content .= '{\*\ffl ' . $text . '}';
}
$content .= '}';
return $content;
} | php | public function getRtfCode()
{
$content = '{\fftype2\ffres25\fftypetxt0\ffhaslistbox\ffdefres0';
foreach ($this->_items as $text) {
$text = PHPRtfLite_Utf8::getUnicodeEntities($text, $this->_rtf->getCharset());
$content .= '{\*\ffl ' . $text . '}';
}
$content .= '}';
return $content;
} | [
"public",
"function",
"getRtfCode",
"(",
")",
"{",
"$",
"content",
"=",
"'{\\fftype2\\ffres25\\fftypetxt0\\ffhaslistbox\\ffdefres0'",
";",
"foreach",
"(",
"$",
"this",
"->",
"_items",
"as",
"$",
"text",
")",
"{",
"$",
"text",
"=",
"PHPRtfLite_Utf8",
"::",
"getUn... | gets rtf code for dropdown form field
@return string | [
"gets",
"rtf",
"code",
"for",
"dropdown",
"form",
"field"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/FormField/Dropdown.php#L78-L87 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table/Nested.php | PHPRtfLite_Table_Nested.render | public function render()
{
if (empty($this->_rows) || empty($this->_columns)) {
return;
}
foreach ($this->_rows as $row) {
$this->renderRowCells($row);
}
} | php | public function render()
{
if (empty($this->_rows) || empty($this->_columns)) {
return;
}
foreach ($this->_rows as $row) {
$this->renderRowCells($row);
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_rows",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"_columns",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"_rows",
"as",
"$",
... | renders nested table | [
"renders",
"nested",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table/Nested.php#L36-L45 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.create | public static function create(PHPRtfLite $rtf, $size = 0, $color = null, $type = null, $space = 0.0,
$left = true, $top = true, $right = true, $bottom = true)
{
$border = new self($rtf);
$border->setBorders(new PHPRtfLite_Border_Format($size, $color, $type, $space), $left, $top, $right, $bottom);
return $border;
} | php | public static function create(PHPRtfLite $rtf, $size = 0, $color = null, $type = null, $space = 0.0,
$left = true, $top = true, $right = true, $bottom = true)
{
$border = new self($rtf);
$border->setBorders(new PHPRtfLite_Border_Format($size, $color, $type, $space), $left, $top, $right, $bottom);
return $border;
} | [
"public",
"static",
"function",
"create",
"(",
"PHPRtfLite",
"$",
"rtf",
",",
"$",
"size",
"=",
"0",
",",
"$",
"color",
"=",
"null",
",",
"$",
"type",
"=",
"null",
",",
"$",
"space",
"=",
"0.0",
",",
"$",
"left",
"=",
"true",
",",
"$",
"top",
"... | creates border by defining border format
@param PHPRtfLite $rtf
@param integer $size size of border
@param string $color color of border (example '#ff0000' or '#f00')
@param string $type represented by class constants PHPRtfLite_Border_Format::TYPE_*<br>
Possible values:<br>
PHPRtfLite_Border_Format::TYPE_SINGLE 'single'<br>
PHPRtfLite_Border_Format::TYPE_DOT 'dot'<br>
PHPRtfLite_Border_Format::TYPE_DASH 'dash'<br>
PHPRtfLite_Border_Format::TYPE_DOTDASH 'dotdash'
@param float $space space between borders and the paragraph
@param boolean $left left border
@param boolean $top top border
@param boolean $right right border
@param boolean $bottom bottom border
@return PHPRtfLite_Border | [
"creates",
"border",
"by",
"defining",
"border",
"format"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L114-L121 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.setBorders | public function setBorders(PHPRtfLite_Border_Format $borderFormat,
$left = true, $top = true, $right = true, $bottom = true)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
if ($left) {
$this->_borderLeft = $borderFormat;
}
if ($top) {
$this->_borderTop = $borderFormat;
}
if ($right) {
$this->_borderRight = $borderFormat;
}
if ($bottom) {
$this->_borderBottom = $borderFormat;
}
} | php | public function setBorders(PHPRtfLite_Border_Format $borderFormat,
$left = true, $top = true, $right = true, $bottom = true)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
if ($left) {
$this->_borderLeft = $borderFormat;
}
if ($top) {
$this->_borderTop = $borderFormat;
}
if ($right) {
$this->_borderRight = $borderFormat;
}
if ($bottom) {
$this->_borderBottom = $borderFormat;
}
} | [
"public",
"function",
"setBorders",
"(",
"PHPRtfLite_Border_Format",
"$",
"borderFormat",
",",
"$",
"left",
"=",
"true",
",",
"$",
"top",
"=",
"true",
",",
"$",
"right",
"=",
"true",
",",
"$",
"bottom",
"=",
"true",
")",
"{",
"$",
"borderFormat",
"->",
... | sets border format of element
@param PHPRtfLite_Border_Format $borderFormat
@param boolean $left
@param boolean $top
@param boolean $right
@param boolean $bottom | [
"sets",
"border",
"format",
"of",
"element"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L133-L153 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.setBorderLeft | public function setBorderLeft(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderLeft = $borderFormat;
} | php | public function setBorderLeft(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderLeft = $borderFormat;
} | [
"public",
"function",
"setBorderLeft",
"(",
"PHPRtfLite_Border_Format",
"$",
"borderFormat",
")",
"{",
"$",
"borderFormat",
"->",
"setColorTable",
"(",
"$",
"this",
"->",
"_rtf",
"->",
"getColorTable",
"(",
")",
")",
";",
"$",
"this",
"->",
"_borderLeft",
"=",... | sets border format for left border
@param PHPRtfLite_Border_Format $borderFormat | [
"sets",
"border",
"format",
"for",
"left",
"border"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L161-L165 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.setBorderRight | public function setBorderRight(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderRight = $borderFormat;
} | php | public function setBorderRight(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderRight = $borderFormat;
} | [
"public",
"function",
"setBorderRight",
"(",
"PHPRtfLite_Border_Format",
"$",
"borderFormat",
")",
"{",
"$",
"borderFormat",
"->",
"setColorTable",
"(",
"$",
"this",
"->",
"_rtf",
"->",
"getColorTable",
"(",
")",
")",
";",
"$",
"this",
"->",
"_borderRight",
"=... | sets border format for right border
@param PHPRtfLite_Border_Format $borderFormat | [
"sets",
"border",
"format",
"for",
"right",
"border"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L184-L188 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.setBorderTop | public function setBorderTop(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderTop = $borderFormat;
} | php | public function setBorderTop(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderTop = $borderFormat;
} | [
"public",
"function",
"setBorderTop",
"(",
"PHPRtfLite_Border_Format",
"$",
"borderFormat",
")",
"{",
"$",
"borderFormat",
"->",
"setColorTable",
"(",
"$",
"this",
"->",
"_rtf",
"->",
"getColorTable",
"(",
")",
")",
";",
"$",
"this",
"->",
"_borderTop",
"=",
... | sets border format for top border
@param PHPRtfLite_Border_Format $borderFormat | [
"sets",
"border",
"format",
"for",
"top",
"border"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L207-L211 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.setBorderBottom | public function setBorderBottom(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderBottom = $borderFormat;
} | php | public function setBorderBottom(PHPRtfLite_Border_Format $borderFormat)
{
$borderFormat->setColorTable($this->_rtf->getColorTable());
$this->_borderBottom = $borderFormat;
} | [
"public",
"function",
"setBorderBottom",
"(",
"PHPRtfLite_Border_Format",
"$",
"borderFormat",
")",
"{",
"$",
"borderFormat",
"->",
"setColorTable",
"(",
"$",
"this",
"->",
"_rtf",
"->",
"getColorTable",
"(",
")",
")",
";",
"$",
"this",
"->",
"_borderBottom",
... | sets border format for bottom border
@param PHPRtfLite_Border_Format $borderFormat | [
"sets",
"border",
"format",
"for",
"bottom",
"border"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L230-L234 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Border.php | PHPRtfLite_Border.getContent | public function getContent($type = '\\')
{
$content = '';
if ($this->_borderLeft) {
$content .= $type . 'brdrl' . $this->_borderLeft->getContent();
}
if ($this->_borderRight) {
$content .= $type . 'brdrr' . $this->_borderRight->getContent();
}
if ($this->_borderTop) {
$content .= $type . 'brdrt' . $this->_borderTop->getContent();
}
if ($this->_borderBottom) {
$content .= $type . 'brdrb' . $this->_borderBottom->getContent();
}
return $content;
} | php | public function getContent($type = '\\')
{
$content = '';
if ($this->_borderLeft) {
$content .= $type . 'brdrl' . $this->_borderLeft->getContent();
}
if ($this->_borderRight) {
$content .= $type . 'brdrr' . $this->_borderRight->getContent();
}
if ($this->_borderTop) {
$content .= $type . 'brdrt' . $this->_borderTop->getContent();
}
if ($this->_borderBottom) {
$content .= $type . 'brdrb' . $this->_borderBottom->getContent();
}
return $content;
} | [
"public",
"function",
"getContent",
"(",
"$",
"type",
"=",
"'\\\\'",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"_borderLeft",
")",
"{",
"$",
"content",
".=",
"$",
"type",
".",
"'brdrl'",
".",
"$",
"this",
"->",
"_borde... | gets rtf code of object
@param string $type rtf code part
@return string rtf code | [
"gets",
"rtf",
"code",
"of",
"object"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Border.php#L254-L270 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.getRow | public function getRow($rowIndex)
{
if (isset($this->_rows[$rowIndex - 1])) {
return $this->_rows[$rowIndex - 1];
}
throw new PHPRtfLite_Exception('Invalid row index for table: ' . $rowIndex);
} | php | public function getRow($rowIndex)
{
if (isset($this->_rows[$rowIndex - 1])) {
return $this->_rows[$rowIndex - 1];
}
throw new PHPRtfLite_Exception('Invalid row index for table: ' . $rowIndex);
} | [
"public",
"function",
"getRow",
"(",
"$",
"rowIndex",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_rows",
"[",
"$",
"rowIndex",
"-",
"1",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_rows",
"[",
"$",
"rowIndex",
"-",
"1",
"]",
... | gets row instance
@param integer $rowIndex
@return PHPRtfLite_Table_Row
@throws PHPRtfLite_Exception, if rowIndex is not valid | [
"gets",
"row",
"instance"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L323-L330 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.getCell | public function getCell($rowIndex, $columnIndex)
{
if ($this->checkIfCellExists($rowIndex, $columnIndex)) {
return $this->getRow($rowIndex)->getCellByIndex($columnIndex);
}
throw new PHPRtfLite_Exception('Wrong index for cell! You gave me: (row:' . $rowIndex . ', column:' . $columnIndex . ')');
} | php | public function getCell($rowIndex, $columnIndex)
{
if ($this->checkIfCellExists($rowIndex, $columnIndex)) {
return $this->getRow($rowIndex)->getCellByIndex($columnIndex);
}
throw new PHPRtfLite_Exception('Wrong index for cell! You gave me: (row:' . $rowIndex . ', column:' . $columnIndex . ')');
} | [
"public",
"function",
"getCell",
"(",
"$",
"rowIndex",
",",
"$",
"columnIndex",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkIfCellExists",
"(",
"$",
"rowIndex",
",",
"$",
"columnIndex",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getRow",
"(",
"$",
... | gets the instance of cell
@param integer $rowIndex
@param integer $columnIndex
@return PHPRtfLite_Table_Cell
@throws PHPRtfLite_Exception, if index for row or column is not valid | [
"gets",
"the",
"instance",
"of",
"cell"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L386-L393 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.writeToCell | public function writeToCell($rowIndex,
$columnIndex,
$text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true)
{
$cell = $this->getCell($rowIndex, $columnIndex);
if ($font === null) {
$font = $cell->getFont();
}
return $cell->writeText($text, $font, $parFormat, $convertTagsToRtf);
} | php | public function writeToCell($rowIndex,
$columnIndex,
$text,
PHPRtfLite_Font $font = null,
PHPRtfLite_ParFormat $parFormat = null,
$convertTagsToRtf = true)
{
$cell = $this->getCell($rowIndex, $columnIndex);
if ($font === null) {
$font = $cell->getFont();
}
return $cell->writeText($text, $font, $parFormat, $convertTagsToRtf);
} | [
"public",
"function",
"writeToCell",
"(",
"$",
"rowIndex",
",",
"$",
"columnIndex",
",",
"$",
"text",
",",
"PHPRtfLite_Font",
"$",
"font",
"=",
"null",
",",
"PHPRtfLite_ParFormat",
"$",
"parFormat",
"=",
"null",
",",
"$",
"convertTagsToRtf",
"=",
"true",
")"... | writes text to cell
@param integer $rowIndex row index of cell
@param integer $columnIndex column index of cell
@param string $text Text. Also you can use html style tags. @see PHPRtfLite_Container#writeText()
@param PHPRtfLite_Font $font Font of text
@param PHPRtfLite_ParFormat $parFormat Paragraph format
@param boolean $convertTagsToRtf If false, then html style tags are not replaced with rtf code.
@return PHPRtfLite_Element | [
"writes",
"text",
"to",
"cell"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L407-L419 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.getValidCellRange | private static function getValidCellRange($startRow, $startColumn, $endRow, $endColumn)
{
if ($endRow === null) {
$endRow = $startRow;
}
elseif ($startRow > $endRow) {
$temp = $startRow;
$startRow = $endRow;
$endRow = $temp;
}
if ($endColumn === null) {
$endColumn = $startColumn;
}
elseif ($startColumn > $endColumn) {
$temp = $startColumn;
$startColumn = $endColumn;
$endColumn = $temp;
}
return array($startRow, $startColumn, $endRow, $endColumn);
} | php | private static function getValidCellRange($startRow, $startColumn, $endRow, $endColumn)
{
if ($endRow === null) {
$endRow = $startRow;
}
elseif ($startRow > $endRow) {
$temp = $startRow;
$startRow = $endRow;
$endRow = $temp;
}
if ($endColumn === null) {
$endColumn = $startColumn;
}
elseif ($startColumn > $endColumn) {
$temp = $startColumn;
$startColumn = $endColumn;
$endColumn = $temp;
}
return array($startRow, $startColumn, $endRow, $endColumn);
} | [
"private",
"static",
"function",
"getValidCellRange",
"(",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
",",
"$",
"endColumn",
")",
"{",
"if",
"(",
"$",
"endRow",
"===",
"null",
")",
"{",
"$",
"endRow",
"=",
"$",
"startRow",
";",
"}",
... | corrects cell range to be valid
@param integer $startRow
@param integer $startColumn
@param integer $endRow
@param integer $endColumn
@return array | [
"corrects",
"cell",
"range",
"to",
"be",
"valid"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L481-L502 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.setVerticalAlignmentForCellRange | public function setVerticalAlignmentForCellRange(
$verticalAlignment,
$startRow,
$startColumn,
$endRow = null,
$endColumn = null
) {
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setVerticalAlignment($verticalAlignment);
}
}
} | php | public function setVerticalAlignmentForCellRange(
$verticalAlignment,
$startRow,
$startColumn,
$endRow = null,
$endColumn = null
) {
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setVerticalAlignment($verticalAlignment);
}
}
} | [
"public",
"function",
"setVerticalAlignmentForCellRange",
"(",
"$",
"verticalAlignment",
",",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
"=",
"null",
",",
"$",
"endColumn",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
"... | sets vertical alignment to cells of a given cell range
@param string $verticalAlignment Vertical alignment of cell (default top). Represented by PHPRtfLite_Container::VERTICAL_ALIGN_*<br>
Possible values:<br>
PHPRtfLite_Container::VERTICAL_ALIGN_TOP => 'top' - top alignment;<br>
PHPRtfLite_Container::VERTICAL_ALIGN_CENTER => 'center' - center alignment;<br>
PHPRtfLite_Container::VERTICAL_ALIGN_BOTTOM => 'bottom' - bottom alignment.
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row, if null, then vertical alignment is set only to the row range.
@param integer $endColumn end column, if null, then vertical alignment is set just to the column range. | [
"sets",
"vertical",
"alignment",
"to",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L538-L556 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.setTextAlignmentForCellRange | public function setTextAlignmentForCellRange($alignment, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setTextAlignment($alignment);
}
}
} | php | public function setTextAlignmentForCellRange($alignment, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setTextAlignment($alignment);
}
}
} | [
"public",
"function",
"setTextAlignmentForCellRange",
"(",
"$",
"alignment",
",",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
"=",
"null",
",",
"$",
"endColumn",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
"startColumn"... | sets alignments to empty cells of a given cell range
@param string $alignment alignment of cell. The method PHPRtfLite_Table_Cell->writeToCell() overrides it with PHPRtfLite_ParFormat alignment.<br>
Alignment is represented by class constants PHPRtfLite_Container::TEXT_ALIGN_*<br>
Possible values:<br>
PHPRtfLite_Container::TEXT_ALIGN_LEFT => 'left' - left alignment<br>
PHPRtfLite_Container::TEXT_ALIGN_RIGHT => 'right' - right alignment<br>
PHPRtfLite_Container::TEXT_ALIGN_CENTER => 'center' - center alignment<br>
PHPRtfLite_Container::TEXT_ALIGN_JUSTIFY => 'justify' - justify alignment
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row, if null, then text alignment is set only to the row range.
@param integer $endColumn end column, if null, then text alignment is set just to the column range. | [
"sets",
"alignments",
"to",
"empty",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L574-L587 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.setFontForCellRange | public function setFontForCellRange(PHPRtfLite_Font $font, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setFont($font);
}
}
} | php | public function setFontForCellRange(PHPRtfLite_Font $font, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setFont($font);
}
}
} | [
"public",
"function",
"setFontForCellRange",
"(",
"PHPRtfLite_Font",
"$",
"font",
",",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
"=",
"null",
",",
"$",
"endColumn",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
"start... | sets font to empty cells of a given cell range
@param PHPRtfLite_Font $font font for empty cells. The method PHPRtfLite_Table_Cell->writeToCell() overrides it with another PHPRtfLite_Font.
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row, if null, then font is set only to the row range.
@param integer $endColumn end column, if null, then font is set just to the column range. | [
"sets",
"font",
"to",
"empty",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L599-L612 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.rotateCellRange | public function rotateCellRange($rotateTo, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->rotateTo($rotateTo);
}
}
} | php | public function rotateCellRange($rotateTo, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->rotateTo($rotateTo);
}
}
} | [
"public",
"function",
"rotateCellRange",
"(",
"$",
"rotateTo",
",",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
"=",
"null",
",",
"$",
"endColumn",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$"... | rotates cells of a given cell range
@param string $rotateTo direction of rotation<br>
Possible values (represented by PHPRtfLite_Table_Cell::ROTATE_*):<br>
PHPRtfLite_Table_Cell::ROTATE_RIGHT => 'right'<br>
PHPRtfLite_Table_Cell::ROTATE_LEFT => 'left'
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row, if null, then rotation is set only to the row range.
@param integer $endColumn end column, if null, then rotation is set just to the column range. | [
"rotates",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L627-L640 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.setBackgroundForCellRange | public function setBackgroundForCellRange(
$backgroundColor,
$startRow,
$startColumn,
$endRow = null,
$endColumn = null
) {
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setBackgroundColor($backgroundColor);
}
}
} | php | public function setBackgroundForCellRange(
$backgroundColor,
$startRow,
$startColumn,
$endRow = null,
$endColumn = null
) {
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setBackgroundColor($backgroundColor);
}
}
} | [
"public",
"function",
"setBackgroundForCellRange",
"(",
"$",
"backgroundColor",
",",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
"=",
"null",
",",
"$",
"endColumn",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
"startColu... | sets background color of cells of a given cell range
@param string $backgroundColor background color
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row, if null, then rotation is set only to the row range.
@param integer $endColumn end column, if null, then rotation is set just to the column range. | [
"sets",
"background",
"color",
"of",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L652-L670 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.setBorderForCellRange | public function setBorderForCellRange(
PHPRtfLite_Border $border,
$startRow,
$startColumn,
$endRow = null,
$endColumn = null
) {
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setBorder(clone($border));
}
}
} | php | public function setBorderForCellRange(
PHPRtfLite_Border $border,
$startRow,
$startColumn,
$endRow = null,
$endColumn = null
) {
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn)
&& $this->checkIfCellExists($endRow, $endColumn))
{
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setBorder(clone($border));
}
}
} | [
"public",
"function",
"setBorderForCellRange",
"(",
"PHPRtfLite_Border",
"$",
"border",
",",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
"=",
"null",
",",
"$",
"endColumn",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
... | sets border to cells of a given cell range
@param PHPRtfLite_Border $border border
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row, if null, then border is set only to the row range.
@param integer $endColumn end column, if null, then border is set just to the column range. | [
"sets",
"border",
"to",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L682-L700 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.mergeCellRange | public function mergeCellRange($startRow, $startColumn, $endRow, $endColumn)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($startRow == $endRow && $startColumn == $endColumn) {
return;
}
if (!$this->checkIfCellExists($endRow, $endColumn)) {
return;
}
for ($j = $startRow; $j <= $endRow; $j++) {
$start = $startColumn;
$cell = $this->getCell($j, $start);
while ($cell->isHorizontalMerged()) {
$start--;
$cell = $this->getCell($j, $start);
}
$end = $endColumn;
$cell = $this->getCell($j, $end);
while ($cell->isHorizontalMerged()) {
$end++;
$cell = $this->getCell($j, $end + 1);
}
$width = 0;
for ($i = $start; $i <= $end; $i++) {
$cell = $this->getCell($j, $i);
if ($j == $startRow) {
$cell->setVerticalMergeStart();
}
else {
$cell->setVerticalMerged();
}
$width += $cell->getWidth();
if ($i != $start) {
$cell->setHorizontalMerged();
}
}
$this->getCell($j, $start)->setWidth($width);
}
} | php | public function mergeCellRange($startRow, $startColumn, $endRow, $endColumn)
{
list($startRow, $startColumn, $endRow, $endColumn)
= PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($startRow == $endRow && $startColumn == $endColumn) {
return;
}
if (!$this->checkIfCellExists($endRow, $endColumn)) {
return;
}
for ($j = $startRow; $j <= $endRow; $j++) {
$start = $startColumn;
$cell = $this->getCell($j, $start);
while ($cell->isHorizontalMerged()) {
$start--;
$cell = $this->getCell($j, $start);
}
$end = $endColumn;
$cell = $this->getCell($j, $end);
while ($cell->isHorizontalMerged()) {
$end++;
$cell = $this->getCell($j, $end + 1);
}
$width = 0;
for ($i = $start; $i <= $end; $i++) {
$cell = $this->getCell($j, $i);
if ($j == $startRow) {
$cell->setVerticalMergeStart();
}
else {
$cell->setVerticalMerged();
}
$width += $cell->getWidth();
if ($i != $start) {
$cell->setHorizontalMerged();
}
}
$this->getCell($j, $start)->setWidth($width);
}
} | [
"public",
"function",
"mergeCellRange",
"(",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
",",
"$",
"endColumn",
")",
"{",
"list",
"(",
"$",
"startRow",
",",
"$",
"startColumn",
",",
"$",
"endRow",
",",
"$",
"endColumn",
")",
"=",
"PHP... | merges cells of a given cell range
@param integer $startRow start row
@param integer $startColumn start column
@param integer $endRow end row
@param integer $endColumn end column
@TODO add source code comments | [
"merges",
"cells",
"of",
"a",
"given",
"cell",
"range"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L747-L796 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.render | public function render()
{
if (empty($this->_rows) || empty($this->_columns)) {
return;
}
$stream = $this->getRtf()->getWriter();
$stream->write('\pard');
foreach ($this->_rows as $row) {
$this->renderRowDefinition($row);
$stream->write("\r\n");
$this->renderRowCells($row);
$stream->write("\r\n" . '\row' . "\r\n");
}
$stream->write('\pard\itap0' . "\r\n");
} | php | public function render()
{
if (empty($this->_rows) || empty($this->_columns)) {
return;
}
$stream = $this->getRtf()->getWriter();
$stream->write('\pard');
foreach ($this->_rows as $row) {
$this->renderRowDefinition($row);
$stream->write("\r\n");
$this->renderRowCells($row);
$stream->write("\r\n" . '\row' . "\r\n");
}
$stream->write('\pard\itap0' . "\r\n");
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_rows",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"_columns",
")",
")",
"{",
"return",
";",
"}",
"$",
"stream",
"=",
"$",
"this",
"->",
"getRtf",
"(",
... | gets rtf code for table
@return string rtf code | [
"gets",
"rtf",
"code",
"for",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L885-L902 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.renderRowDefinition | public function renderRowDefinition(PHPRtfLite_Table_Row $row)
{
$rowIndex = $row->getRowIndex();
$stream = $this->getRtf()->getWriter();
$stream->write('\trowd');
if ($this->_alignment) {
switch ($this->_alignment) {
case self::ALIGN_CENTER:
$stream->write('\trqc');
break;
case self::ALIGN_RIGHT:
$stream->write('\trqr');
break;
default:
$stream->write('\trql');
break;
}
}
$rowHeight = $row->getHeight();
if ($rowHeight) {
$stream->write('\trrh' . PHPRtfLite_Unit::getUnitInTwips($rowHeight));
}
if ($this->isPreventPageBreak()) {
$stream->write('\trkeep ');
}
if ($this->isFirstRowHeader() && $rowIndex == 1) {
$stream->write('\trhdr ');
}
if ($this->getLeftPosition() != '') {
$stream->write('\trleft' . PHPRtfLite_Unit::getUnitInTwips($this->getLeftPosition()) . ' ');
}
$width = 0;
foreach ($this->getColumns() as $columnIndex => $column) {
$cell = $this->getCell($rowIndex, $columnIndex + 1);
// render cell definition
if (!$cell->isHorizontalMerged()) {
$cell->renderDefinition();
// cell width
$width += PHPRtfLite_Unit::getUnitInTwips($cell->getWidth());
$stream->write('\cellx' . $width);
}
}
} | php | public function renderRowDefinition(PHPRtfLite_Table_Row $row)
{
$rowIndex = $row->getRowIndex();
$stream = $this->getRtf()->getWriter();
$stream->write('\trowd');
if ($this->_alignment) {
switch ($this->_alignment) {
case self::ALIGN_CENTER:
$stream->write('\trqc');
break;
case self::ALIGN_RIGHT:
$stream->write('\trqr');
break;
default:
$stream->write('\trql');
break;
}
}
$rowHeight = $row->getHeight();
if ($rowHeight) {
$stream->write('\trrh' . PHPRtfLite_Unit::getUnitInTwips($rowHeight));
}
if ($this->isPreventPageBreak()) {
$stream->write('\trkeep ');
}
if ($this->isFirstRowHeader() && $rowIndex == 1) {
$stream->write('\trhdr ');
}
if ($this->getLeftPosition() != '') {
$stream->write('\trleft' . PHPRtfLite_Unit::getUnitInTwips($this->getLeftPosition()) . ' ');
}
$width = 0;
foreach ($this->getColumns() as $columnIndex => $column) {
$cell = $this->getCell($rowIndex, $columnIndex + 1);
// render cell definition
if (!$cell->isHorizontalMerged()) {
$cell->renderDefinition();
// cell width
$width += PHPRtfLite_Unit::getUnitInTwips($cell->getWidth());
$stream->write('\cellx' . $width);
}
}
} | [
"public",
"function",
"renderRowDefinition",
"(",
"PHPRtfLite_Table_Row",
"$",
"row",
")",
"{",
"$",
"rowIndex",
"=",
"$",
"row",
"->",
"getRowIndex",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"getRtf",
"(",
")",
"->",
"getWriter",
"(",
")",
... | renders row definition
@param PHPRtfLite_Table_Row $row | [
"renders",
"row",
"definition"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L910-L962 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Table.php | PHPRtfLite_Table.renderRowCells | protected function renderRowCells(PHPRtfLite_Table_Row $row)
{
$rowIndex = $row->getRowIndex();
foreach ($this->getColumns() as $columnIndex => $column) {
$cell = $this->getCell($rowIndex, $columnIndex + 1);
if (!$cell->isHorizontalMerged()) {
$cell->render();
}
}
} | php | protected function renderRowCells(PHPRtfLite_Table_Row $row)
{
$rowIndex = $row->getRowIndex();
foreach ($this->getColumns() as $columnIndex => $column) {
$cell = $this->getCell($rowIndex, $columnIndex + 1);
if (!$cell->isHorizontalMerged()) {
$cell->render();
}
}
} | [
"protected",
"function",
"renderRowCells",
"(",
"PHPRtfLite_Table_Row",
"$",
"row",
")",
"{",
"$",
"rowIndex",
"=",
"$",
"row",
"->",
"getRowIndex",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getColumns",
"(",
")",
"as",
"$",
"columnIndex",
"=>",
... | renders row cells
@param PHPRtfLite_Table_Row $row | [
"renders",
"row",
"cells"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Table.php#L970-L980 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite/Image/Gd.php | PHPRtfLite_Image_Gd.setImageType | protected function setImageType($imageType)
{
switch ($imageType) {
case self::TYPE_JPEG:
$this->_imageRtfType = '\jpegblip';
break;
default:
$this->_imageRtfType = '\\' . $imageType . 'blip';
break;
}
} | php | protected function setImageType($imageType)
{
switch ($imageType) {
case self::TYPE_JPEG:
$this->_imageRtfType = '\jpegblip';
break;
default:
$this->_imageRtfType = '\\' . $imageType . 'blip';
break;
}
} | [
"protected",
"function",
"setImageType",
"(",
"$",
"imageType",
")",
"{",
"switch",
"(",
"$",
"imageType",
")",
"{",
"case",
"self",
"::",
"TYPE_JPEG",
":",
"$",
"this",
"->",
"_imageRtfType",
"=",
"'\\jpegblip'",
";",
"break",
";",
"default",
":",
"$",
... | sets image type
@param string $imageType | [
"sets",
"image",
"type"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite/Image/Gd.php#L40-L50 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.setProperty | public function setProperty($name, $value)
{
switch ($name) {
case 'creatim':
case 'revtim':
case 'buptim':
case 'printim':
$year = date('Y', $value);
$month = date('m', $value);
$day = date('d', $value);
$hours = date('H', $value);
$minutes = date('i', $value);
$value = '\yr' . $year
. '\mo' . $month
. '\dy' . $day
. '\hr' . $hours
. '\min' . $minutes;
break;
default:
$value = self::quoteRtfCode($value);
}
$this->_properties[$name] = $value;
} | php | public function setProperty($name, $value)
{
switch ($name) {
case 'creatim':
case 'revtim':
case 'buptim':
case 'printim':
$year = date('Y', $value);
$month = date('m', $value);
$day = date('d', $value);
$hours = date('H', $value);
$minutes = date('i', $value);
$value = '\yr' . $year
. '\mo' . $month
. '\dy' . $day
. '\hr' . $hours
. '\min' . $minutes;
break;
default:
$value = self::quoteRtfCode($value);
}
$this->_properties[$name] = $value;
} | [
"public",
"function",
"setProperty",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"'creatim'",
":",
"case",
"'revtim'",
":",
"case",
"'buptim'",
":",
"case",
"'printim'",
":",
"$",
"year",
"=",
"date",
... | sets document information properties
@param string $name Property of document. Possible properties: <br>
'title' => title of the document (value string)<br>
'subject' => subject of the document (value string)<br>
'author' => author of the document (value string)<br>
'manager' => manager of the document (value string)<br>
'company' => company of author (value string)<br>
'operator' => operator of document. Operator is a person who last made changes to the document. (value string) <br>
'category' => category of document (value string)<br>
'keywords' => keywords of document (value string)<br>
'doccomm' => comments of document (value string)<br>
'creatim' => creation time (value int) <br>
'revtim' => last revision time (value int) <br>
'buptim' => last backup time (value int) <br>
'printim' => last print time (value int) <br>
@param mixed $value Value | [
"sets",
"document",
"information",
"properties"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L327-L351 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.addSection | public function addSection(PHPRtfLite_Container_Section $section = null)
{
if ($section === null) {
$section = new PHPRtfLite_Container_Section($this);
}
$this->_sections[] = $section;
return $section;
} | php | public function addSection(PHPRtfLite_Container_Section $section = null)
{
if ($section === null) {
$section = new PHPRtfLite_Container_Section($this);
}
$this->_sections[] = $section;
return $section;
} | [
"public",
"function",
"addSection",
"(",
"PHPRtfLite_Container_Section",
"$",
"section",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"section",
"===",
"null",
")",
"{",
"$",
"section",
"=",
"new",
"PHPRtfLite_Container_Section",
"(",
"$",
"this",
")",
";",
"}",
... | adds section to rtf document
@param PHPRtfLite_Container_Section $section
@return PHPRtfLite_Container_Section | [
"adds",
"section",
"to",
"rtf",
"document"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L541-L550 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.setPaperFormat | public function setPaperFormat($paperFormat)
{
$defaultUnit = PHPRtfLite_Unit::getGlobalUnit();
$paperWidth = PHPRtfLite_Paper_Format::getPaperWidthByPaperFormat($paperFormat);
$this->_paperWidth = PHPRtfLite_Unit::convertTo($paperWidth, PHPRtfLite_Unit::UNIT_MM, $defaultUnit);
$paperHeight = PHPRtfLite_Paper_Format::getPaperHeightByPaperFormat($paperFormat);
$this->_paperHeight = PHPRtfLite_Unit::convertTo($paperHeight, PHPRtfLite_Unit::UNIT_MM, $defaultUnit);
} | php | public function setPaperFormat($paperFormat)
{
$defaultUnit = PHPRtfLite_Unit::getGlobalUnit();
$paperWidth = PHPRtfLite_Paper_Format::getPaperWidthByPaperFormat($paperFormat);
$this->_paperWidth = PHPRtfLite_Unit::convertTo($paperWidth, PHPRtfLite_Unit::UNIT_MM, $defaultUnit);
$paperHeight = PHPRtfLite_Paper_Format::getPaperHeightByPaperFormat($paperFormat);
$this->_paperHeight = PHPRtfLite_Unit::convertTo($paperHeight, PHPRtfLite_Unit::UNIT_MM, $defaultUnit);
} | [
"public",
"function",
"setPaperFormat",
"(",
"$",
"paperFormat",
")",
"{",
"$",
"defaultUnit",
"=",
"PHPRtfLite_Unit",
"::",
"getGlobalUnit",
"(",
")",
";",
"$",
"paperWidth",
"=",
"PHPRtfLite_Paper_Format",
"::",
"getPaperWidthByPaperFormat",
"(",
"$",
"paperFormat... | Sets the paper format.
@param string $paperFormat | [
"Sets",
"the",
"paper",
"format",
"."
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L591-L600 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.addHeader | public function addHeader($type = PHPRtfLite_Container_Header::TYPE_ALL, PHPRtfLite_Container_Header $header = null)
{
if ($header === null) {
$header = new PHPRtfLite_Container_Header($this, $type);
}
$this->_headers[$type] = $header;
return $header;
} | php | public function addHeader($type = PHPRtfLite_Container_Header::TYPE_ALL, PHPRtfLite_Container_Header $header = null)
{
if ($header === null) {
$header = new PHPRtfLite_Container_Header($this, $type);
}
$this->_headers[$type] = $header;
return $header;
} | [
"public",
"function",
"addHeader",
"(",
"$",
"type",
"=",
"PHPRtfLite_Container_Header",
"::",
"TYPE_ALL",
",",
"PHPRtfLite_Container_Header",
"$",
"header",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"header",
"===",
"null",
")",
"{",
"$",
"header",
"=",
"new",... | creates header for the document
@param string $type
Represented by class constants PHPRtfLite_Container_Header::TYPE_* <br>
Possible values: <br>
PHPRtfLite_Container_Header::TYPE_ALL
all pages (different odd and even headers/footers must be not set) <br>
PHPRtfLite_Container_Header::TYPE_LEFT
left pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Header::TYPE_RIGHT
right pages (different odd and even headers/footers must be set <br>
PHPRtfLite_Container_Header::TYPE_FIRST
first page
@param PHPRtfLite_Container_Header $header
@return PHPRtfLite_Container_Header | [
"creates",
"header",
"for",
"the",
"document"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1051-L1059 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.addFooter | public function addFooter($type = PHPRtfLite_Container_Footer::TYPE_ALL, PHPRtfLite_Container_Footer $footer = null)
{
if ($footer === null) {
$footer = new PHPRtfLite_Container_Footer($this, $type);
}
$this->_footers[$type] = $footer;
return $footer;
} | php | public function addFooter($type = PHPRtfLite_Container_Footer::TYPE_ALL, PHPRtfLite_Container_Footer $footer = null)
{
if ($footer === null) {
$footer = new PHPRtfLite_Container_Footer($this, $type);
}
$this->_footers[$type] = $footer;
return $footer;
} | [
"public",
"function",
"addFooter",
"(",
"$",
"type",
"=",
"PHPRtfLite_Container_Footer",
"::",
"TYPE_ALL",
",",
"PHPRtfLite_Container_Footer",
"$",
"footer",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"footer",
"===",
"null",
")",
"{",
"$",
"footer",
"=",
"new",... | creates footer for the document
@param string $type
Represented by class constants PHPRtfLite_Container_Footer::TYPE_* <br>
Possible values: <br>
PHPRtfLite_Container_Footer::TYPE_ALL
all pages (different odd and even headers/footers must be not set) <br>
PHPRtfLite_Container_Footer::TYPE_LEFT
left pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Footer::TYPE_RIGHT
right pages (different odd and even headers/footers must be set) <br>
PHPRtfLite_Container_Footer::TYPE_FIRST
first page
@param PHPRtfLite_Container_Footer $footer
@return PHPRtfLite_Container_Footer | [
"creates",
"footer",
"for",
"the",
"document"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1091-L1099 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.registerFont | public function registerFont(PHPRtfLite_Font $font)
{
$font->setColorTable($this->getColorTable());
$font->setFontTable($this->getFontTable());
} | php | public function registerFont(PHPRtfLite_Font $font)
{
$font->setColorTable($this->getColorTable());
$font->setFontTable($this->getFontTable());
} | [
"public",
"function",
"registerFont",
"(",
"PHPRtfLite_Font",
"$",
"font",
")",
"{",
"$",
"font",
"->",
"setColorTable",
"(",
"$",
"this",
"->",
"getColorTable",
"(",
")",
")",
";",
"$",
"font",
"->",
"setFontTable",
"(",
"$",
"this",
"->",
"getFontTable",... | registers the font in color table and font table
@param PHPRtfLite_Font $font | [
"registers",
"the",
"font",
"in",
"color",
"table",
"and",
"font",
"table"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1145-L1149 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.getContent | public function getContent($free = true)
{
$this->createWriter();
$this->render();
if ($free) {
$this->free();
}
return $this->_writer->getContent();
} | php | public function getContent($free = true)
{
$this->createWriter();
$this->render();
if ($free) {
$this->free();
}
return $this->_writer->getContent();
} | [
"public",
"function",
"getContent",
"(",
"$",
"free",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"createWriter",
"(",
")",
";",
"$",
"this",
"->",
"render",
"(",
")",
";",
"if",
"(",
"$",
"free",
")",
"{",
"$",
"this",
"->",
"free",
"(",
")",
";... | gets rtf document code
@param bool $free
@return string | [
"gets",
"rtf",
"document",
"code"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1192-L1200 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.save | public function save($file, $free = true)
{
$this->createWriter($file);
$this->render();
if ($free) {
$this->free();
}
} | php | public function save($file, $free = true)
{
$this->createWriter($file);
$this->render();
if ($free) {
$this->free();
}
} | [
"public",
"function",
"save",
"(",
"$",
"file",
",",
"$",
"free",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"createWriter",
"(",
"$",
"file",
")",
";",
"$",
"this",
"->",
"render",
"(",
")",
";",
"if",
"(",
"$",
"free",
")",
"{",
"$",
"this",
... | saves rtf document to file
@param string $file Name of file
@param bool $free | [
"saves",
"rtf",
"document",
"to",
"file"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1209-L1216 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.sendRtf | public function sendRtf($filename = 'simple', $free = true)
{
$pathInfo = pathinfo($filename);
if (empty($pathInfo['extension'])) {
$filename .= '.rtf';
}
if (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
header('Content-Disposition: filename="' . $filename . '"');
}
else {
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
header('Content-type: application/msword');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
$this->createWriter();
$this->render();
if ($free) {
$this->free();
}
echo $this->_writer->getContent();
} | php | public function sendRtf($filename = 'simple', $free = true)
{
$pathInfo = pathinfo($filename);
if (empty($pathInfo['extension'])) {
$filename .= '.rtf';
}
if (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5')) {
header('Content-Disposition: filename="' . $filename . '"');
}
else {
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
header('Content-type: application/msword');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
$this->createWriter();
$this->render();
if ($free) {
$this->free();
}
echo $this->_writer->getContent();
} | [
"public",
"function",
"sendRtf",
"(",
"$",
"filename",
"=",
"'simple'",
",",
"$",
"free",
"=",
"true",
")",
"{",
"$",
"pathInfo",
"=",
"pathinfo",
"(",
"$",
"filename",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"pathInfo",
"[",
"'extension'",
"]",
")",... | sends rtf content as file attachment
@param string $filename | [
"sends",
"rtf",
"content",
"as",
"file",
"attachment"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1232-L1259 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.getInfoPart | protected function getInfoPart()
{
$part = '{\info'."\r\n";
foreach ($this->_properties as $key => $value) {
$value = PHPRtfLite_Utf8::getUnicodeEntities($value, $this->_charset);
$part .= '{\\' . $key . ' ' . $value . '}'."\r\n";
}
$part .= '}'."\r\n";
return $part;
} | php | protected function getInfoPart()
{
$part = '{\info'."\r\n";
foreach ($this->_properties as $key => $value) {
$value = PHPRtfLite_Utf8::getUnicodeEntities($value, $this->_charset);
$part .= '{\\' . $key . ' ' . $value . '}'."\r\n";
}
$part .= '}'."\r\n";
return $part;
} | [
"protected",
"function",
"getInfoPart",
"(",
")",
"{",
"$",
"part",
"=",
"'{\\info'",
".",
"\"\\r\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"_properties",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"PHPRtfLite_Utf8",
"::",
... | gets rtf info part
@return string | [
"gets",
"rtf",
"info",
"part"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1267-L1279 | train |
phprtflite/PHPRtfLite | lib/PHPRtfLite.php | PHPRtfLite.quoteRtfCode | public static function quoteRtfCode($text, $convertNewlines = true)
{
// escape backslashes and curly brackets
$text = str_replace(array('\\', '{', '}'), array('\\\\', '\\{', '\\}'), $text);
if ($convertNewlines) {
$text = self::convertNewlinesToRtfCode($text);
}
return $text;
} | php | public static function quoteRtfCode($text, $convertNewlines = true)
{
// escape backslashes and curly brackets
$text = str_replace(array('\\', '{', '}'), array('\\\\', '\\{', '\\}'), $text);
if ($convertNewlines) {
$text = self::convertNewlinesToRtfCode($text);
}
return $text;
} | [
"public",
"static",
"function",
"quoteRtfCode",
"(",
"$",
"text",
",",
"$",
"convertNewlines",
"=",
"true",
")",
"{",
"// escape backslashes and curly brackets",
"$",
"text",
"=",
"str_replace",
"(",
"array",
"(",
"'\\\\'",
",",
"'{'",
",",
"'}'",
")",
",",
... | quotes rtf code
@param string $text
@param boolean $convertNewlines
@return string | [
"quotes",
"rtf",
"code"
] | 0cf7bfd3018ae62058d9be9e3e519cb17c6672a8 | https://github.com/phprtflite/PHPRtfLite/blob/0cf7bfd3018ae62058d9be9e3e519cb17c6672a8/lib/PHPRtfLite.php#L1311-L1320 | train |
rinvex/laravel-tenants | src/Traits/Tenantable.php | Tenantable.bootTenantable | public static function bootTenantable()
{
if ($tenant = config('rinvex.tenants.active')) {
static::addGlobalScope('tenantable', function (Builder $builder) use ($tenant) {
$builder->whereHas('tenants', function (Builder $builder) use ($tenant) {
$key = $tenant instanceof Model ? $tenant->getKeyName() : (is_int($tenant) ? 'id' : 'slug');
$value = $tenant instanceof Model ? $tenant->{$key} : $tenant;
$builder->where($key, $value);
});
});
static::saved(function (self $model) use ($tenant) {
$model->attachTenants($tenant);
});
}
static::deleted(function (self $model) {
$model->tenants()->detach();
});
} | php | public static function bootTenantable()
{
if ($tenant = config('rinvex.tenants.active')) {
static::addGlobalScope('tenantable', function (Builder $builder) use ($tenant) {
$builder->whereHas('tenants', function (Builder $builder) use ($tenant) {
$key = $tenant instanceof Model ? $tenant->getKeyName() : (is_int($tenant) ? 'id' : 'slug');
$value = $tenant instanceof Model ? $tenant->{$key} : $tenant;
$builder->where($key, $value);
});
});
static::saved(function (self $model) use ($tenant) {
$model->attachTenants($tenant);
});
}
static::deleted(function (self $model) {
$model->tenants()->detach();
});
} | [
"public",
"static",
"function",
"bootTenantable",
"(",
")",
"{",
"if",
"(",
"$",
"tenant",
"=",
"config",
"(",
"'rinvex.tenants.active'",
")",
")",
"{",
"static",
"::",
"addGlobalScope",
"(",
"'tenantable'",
",",
"function",
"(",
"Builder",
"$",
"builder",
"... | Boot the tenantable trait for the model.
@return void | [
"Boot",
"the",
"tenantable",
"trait",
"for",
"the",
"model",
"."
] | a7700cddf4a304ab241025a6ef4bc4eb274983e6 | https://github.com/rinvex/laravel-tenants/blob/a7700cddf4a304ab241025a6ef4bc4eb274983e6/src/Traits/Tenantable.php#L83-L102 | train |
rinvex/laravel-tenants | src/Traits/Tenantable.php | Tenantable.hasTenants | public function hasTenants($tenants): bool
{
$tenants = $this->prepareTenantIds($tenants);
return ! $this->tenants->pluck('id')->intersect($tenants)->isEmpty();
} | php | public function hasTenants($tenants): bool
{
$tenants = $this->prepareTenantIds($tenants);
return ! $this->tenants->pluck('id')->intersect($tenants)->isEmpty();
} | [
"public",
"function",
"hasTenants",
"(",
"$",
"tenants",
")",
":",
"bool",
"{",
"$",
"tenants",
"=",
"$",
"this",
"->",
"prepareTenantIds",
"(",
"$",
"tenants",
")",
";",
"return",
"!",
"$",
"this",
"->",
"tenants",
"->",
"pluck",
"(",
"'id'",
")",
"... | Determine if the model has any of the given tenants.
@param mixed $tenants
@return bool | [
"Determine",
"if",
"the",
"model",
"has",
"any",
"of",
"the",
"given",
"tenants",
"."
] | a7700cddf4a304ab241025a6ef4bc4eb274983e6 | https://github.com/rinvex/laravel-tenants/blob/a7700cddf4a304ab241025a6ef4bc4eb274983e6/src/Traits/Tenantable.php#L227-L232 | train |
rinvex/laravel-tenants | src/Traits/Tenantable.php | Tenantable.hasAllTenants | public function hasAllTenants($tenants): bool
{
$tenants = $this->prepareTenantIds($tenants);
return collect($tenants)->diff($this->tenants->pluck('id'))->isEmpty();
} | php | public function hasAllTenants($tenants): bool
{
$tenants = $this->prepareTenantIds($tenants);
return collect($tenants)->diff($this->tenants->pluck('id'))->isEmpty();
} | [
"public",
"function",
"hasAllTenants",
"(",
"$",
"tenants",
")",
":",
"bool",
"{",
"$",
"tenants",
"=",
"$",
"this",
"->",
"prepareTenantIds",
"(",
"$",
"tenants",
")",
";",
"return",
"collect",
"(",
"$",
"tenants",
")",
"->",
"diff",
"(",
"$",
"this",... | Determine if the model has all of the given tenants.
@param mixed $tenants
@return bool | [
"Determine",
"if",
"the",
"model",
"has",
"all",
"of",
"the",
"given",
"tenants",
"."
] | a7700cddf4a304ab241025a6ef4bc4eb274983e6 | https://github.com/rinvex/laravel-tenants/blob/a7700cddf4a304ab241025a6ef4bc4eb274983e6/src/Traits/Tenantable.php#L253-L258 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.