ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (string $a_text)
 

Protected Attributes

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilICalWriter::__construct ( )

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

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

Member Function Documentation

◆ __toString()

ilICalWriter::__toString ( )

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

Referenced by byteCount().

94  : string
95  {
96  return implode('', $this->lines);
97  }
+ Here is the caller graph for this function:

◆ addLine()

ilICalWriter::addLine ( string  $a_line)

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

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

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

◆ append()

ilICalWriter::append ( ilICalWriter  $other)

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

89  : void
90  {
91  $this->lines = array_merge($this->lines, $other->lines);
92  }

◆ byteCount()

ilICalWriter::byteCount ( )

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

References __toString().

79  : int
80  {
81  return strlen($this->__toString());
82  }
+ Here is the call graph for this function:

◆ clear()

ilICalWriter::clear ( )

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

84  : void
85  {
86  $this->lines = [];
87  }

◆ escapeText()

static ilICalWriter::escapeText ( string  $a_text)
static

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

Referenced by ilCalendarExport\createVEVENT().

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

Field Documentation

◆ $lines

array ilICalWriter::$lines
protected

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

◆ BEGIN_LINE_WHITESPACE

const ilICalWriter::BEGIN_LINE_WHITESPACE = ' '
protected

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

◆ EMPTY

const ilICalWriter::EMPTY = ''
protected

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

◆ LINE_SIZE

const ilICalWriter::LINE_SIZE = 74
protected

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

◆ LINEBREAK

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

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


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