ILIAS  release_7 Revision v7.30-3-g800a261c036
ilICalWriter Class Reference
+ Collaboration diagram for ilICalWriter:

Public Member Functions

 __construct ()
 
 addLine (string $a_line)
 
 byteCount ()
 
 clear ()
 
 append (ilICalWriter $other)
 
 __toString ()
 

Static Public Member Functions

static escapeText ($a_text)
 

Protected Attributes

const LINEBREAK = "\r\n"
 
const LINE_SIZE = 74
 
const BEGIN_LINE_WHITESPACE = ' '
 
const EMPTY = ''
 
 $lines
 

Detailed Description

Definition at line 24 of file class.ilICalWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilICalWriter::__construct ( )

Definition at line 37 of file class.ilICalWriter.php.

38  {
39  $this->lines = [];
40  }

Member Function Documentation

◆ __toString()

ilICalWriter::__toString ( )

Definition at line 99 of file class.ilICalWriter.php.

Referenced by byteCount().

99  : string
100  {
101  return implode('', $this->lines);
102  }
+ Here is the caller graph for this function:

◆ addLine()

ilICalWriter::addLine ( string  $a_line)

Definition at line 61 of file class.ilICalWriter.php.

References $i, ilStr\strLen(), and ilStr\subStr().

61  : void
62  {
63  //$chunks = str_split($a_line, self::LINE_SIZE);
64 
65  include_once './Services/Utilities/classes/class.ilStr.php';
66 
67  // use multibyte split
68  $chunks = [];
69  $len = ilStr::strLen($a_line);
70  while ($len) {
71  $chunks[] = ilStr::subStr($a_line, 0, self::LINE_SIZE);
72  $a_line = ilStr::subStr($a_line, self::LINE_SIZE, $len);
73  $len = ilStr::strLen($a_line);
74  }
75 
76  for ($i = 0; $i < count($chunks); $i++) {
77  $line = ($i > 0) ? self::BEGIN_LINE_WHITESPACE : self::EMPTY;
78  $line .= $chunks[$i];
79  $line .= (isset($chunks[$i + 1]) || ($i + 1) === count($chunks)) ? self::LINEBREAK : self::EMPTY;
80  $this->lines[] = $line;
81  }
82  }
static strLen($a_string)
Definition: class.ilStr.php:78
static subStr($a_str, $a_start, $a_length=null)
Definition: class.ilStr.php:15
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ append()

ilICalWriter::append ( ilICalWriter  $other)

Definition at line 94 of file class.ilICalWriter.php.

94  : void
95  {
96  $this->lines = array_merge($this->lines, $other->lines);
97  }

◆ byteCount()

ilICalWriter::byteCount ( )

Definition at line 84 of file class.ilICalWriter.php.

References __toString().

84  : int
85  {
86  return strlen($this->__toString());
87  }
+ Here is the call graph for this function:

◆ clear()

ilICalWriter::clear ( )

Definition at line 89 of file class.ilICalWriter.php.

89  : void
90  {
91  $this->lines = [];
92  }

◆ escapeText()

static ilICalWriter::escapeText (   $a_text)
static

Definition at line 42 of file class.ilICalWriter.php.

Referenced by ilCalendarExport\createVEVENT().

43  {
44  $a_text = str_replace("\r\n", '\\n', $a_text);
45 
46  return preg_replace(
47  array(
48  '/\\\/',
49  '/;/',
50  '/,/',
51  ),
52  array(
53  '\\',
54  '\;',
55  '\,',
56  ),
57  $a_text
58  );
59  }
+ Here is the caller graph for this function:

Field Documentation

◆ $lines

ilICalWriter::$lines
protected

Definition at line 35 of file class.ilICalWriter.php.

◆ BEGIN_LINE_WHITESPACE

const ilICalWriter::BEGIN_LINE_WHITESPACE = ' '
protected

Definition at line 29 of file class.ilICalWriter.php.

◆ EMPTY

const ilICalWriter::EMPTY = ''
protected

Definition at line 30 of file class.ilICalWriter.php.

◆ LINE_SIZE

const ilICalWriter::LINE_SIZE = 74
protected

Definition at line 28 of file class.ilICalWriter.php.

◆ LINEBREAK

const ilICalWriter::LINEBREAK = "\r\n"
protected

Definition at line 26 of file class.ilICalWriter.php.


The documentation for this class was generated from the following file: