ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\COPage\Html\TransformUtil Class Reference
+ Collaboration diagram for ILIAS\COPage\Html\TransformUtil:

Public Member Functions

 getPosOfPlaceholder (string $html, string $tag, int $offset=0)
 
 getEndPosOfPlaceholder (string $html, int $offset=0)
 
 getPlaceholderParamString (string $html, string $tag)
 
 getPlaceholderParams (string $html, string $tag)
 
 getInnerContentOfPlaceholders (string $html, string $start_tag, string $end_tag)
 parameters of start and end tag must match {{{{{StartTag;a;b;c}}}}}...inner content...{{{{{EndTag;a;b;c}}}}} More...
 
 replaceInnerContentAndPlaceholders (string $html, string $start_tag, string $end_tag, string $replacement)
 parameters of start and end tag must match {{{{{StartTag;a;b;c}}}}}...inner content...{{{{{EndTag;a;b;c}}}}} ...replacement... More...
 

Protected Attributes

const PH_START = "{{{{{"
 
const PH_END = "}}}}}"
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file TransformUtil.php.

Member Function Documentation

◆ getEndPosOfPlaceholder()

ILIAS\COPage\Html\TransformUtil::getEndPosOfPlaceholder ( string  $html,
int  $offset = 0 
)

Definition at line 37 of file TransformUtil.php.

37 : ?int
38 {
39 $p = strpos($html, self::PH_END, $offset);
40 return is_int($p) ? ($p + strlen(self::PH_END)) : null;
41 }

Referenced by ILIAS\COPage\Html\TransformUtil\getInnerContentOfPlaceholders(), ILIAS\COPage\Html\TransformUtil\getPlaceholderParamString(), and ILIAS\COPage\Html\TransformUtil\replaceInnerContentAndPlaceholders().

+ Here is the caller graph for this function:

◆ getInnerContentOfPlaceholders()

ILIAS\COPage\Html\TransformUtil::getInnerContentOfPlaceholders ( string  $html,
string  $start_tag,
string  $end_tag 
)

parameters of start and end tag must match {{{{{StartTag;a;b;c}}}}}...inner content...{{{{{EndTag;a;b;c}}}}}

Definition at line 67 of file TransformUtil.php.

67 : ?string
68 {
69 $start1 = $this->getPosOfPlaceholder($html, $start_tag);
70 if (is_int($start1)) {
71 $end1 = $this->getEndPosOfPlaceholder($html, $start1);
72 $param_str = $this->getPlaceholderParamString($html, $start_tag);
73 $end_tag_with_params = str_replace($start_tag . ";", $end_tag . ";", $param_str);
74 $start2 = $this->getPosOfPlaceholder($html, $end_tag_with_params);
75 if (is_int($end1) && is_int($start2)) {
76 $end2 = $this->getEndPosOfPlaceholder($html, $start2);
77 if (is_int($end2)) {
78 return substr($html, $end1, $start2 - $end1);
79 }
80 }
81 }
82 return null;
83 }
getPosOfPlaceholder(string $html, string $tag, int $offset=0)
getPlaceholderParamString(string $html, string $tag)
getEndPosOfPlaceholder(string $html, int $offset=0)

References ILIAS\COPage\Html\TransformUtil\getEndPosOfPlaceholder(), ILIAS\COPage\Html\TransformUtil\getPlaceholderParamString(), and ILIAS\COPage\Html\TransformUtil\getPosOfPlaceholder().

+ Here is the call graph for this function:

◆ getPlaceholderParams()

ILIAS\COPage\Html\TransformUtil::getPlaceholderParams ( string  $html,
string  $tag 
)

Definition at line 54 of file TransformUtil.php.

54 : ?array
55 {
56 $tag_string = $this->getPlaceholderParamString($html, $tag);
57 if (is_string($tag_string)) {
58 return explode(";", $tag_string);
59 }
60 return null;
61 }

References ILIAS\COPage\Html\TransformUtil\getPlaceholderParamString().

+ Here is the call graph for this function:

◆ getPlaceholderParamString()

ILIAS\COPage\Html\TransformUtil::getPlaceholderParamString ( string  $html,
string  $tag 
)

Definition at line 43 of file TransformUtil.php.

43 : ?string
44 {
45 $start = $this->getPosOfPlaceholder($html, $tag);
46 if (is_int($start)) {
47 $end = $this->getEndPosOfPlaceholder($html, $start);
48 $tag_string = substr($html, $start + strlen(self::PH_START), $end - $start - strlen(self::PH_START) - strlen(self::PH_END));
49 return $tag_string;
50 }
51 return null;
52 }

References ILIAS\COPage\Html\TransformUtil\getEndPosOfPlaceholder(), and ILIAS\COPage\Html\TransformUtil\getPosOfPlaceholder().

Referenced by ILIAS\COPage\Html\TransformUtil\getInnerContentOfPlaceholders(), ILIAS\COPage\Html\TransformUtil\getPlaceholderParams(), and ILIAS\COPage\Html\TransformUtil\replaceInnerContentAndPlaceholders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPosOfPlaceholder()

ILIAS\COPage\Html\TransformUtil::getPosOfPlaceholder ( string  $html,
string  $tag,
int  $offset = 0 
)

Definition at line 31 of file TransformUtil.php.

31 : ?int
32 {
33 $p = strpos($html, self::PH_START . $tag, $offset);
34 return is_int($p) ? $p : null;
35 }

Referenced by ILIAS\COPage\Html\TransformUtil\getInnerContentOfPlaceholders(), ILIAS\COPage\Html\TransformUtil\getPlaceholderParamString(), and ILIAS\COPage\Html\TransformUtil\replaceInnerContentAndPlaceholders().

+ Here is the caller graph for this function:

◆ replaceInnerContentAndPlaceholders()

ILIAS\COPage\Html\TransformUtil::replaceInnerContentAndPlaceholders ( string  $html,
string  $start_tag,
string  $end_tag,
string  $replacement 
)

parameters of start and end tag must match {{{{{StartTag;a;b;c}}}}}...inner content...{{{{{EndTag;a;b;c}}}}} ...replacement...

Definition at line 90 of file TransformUtil.php.

90 : ?string
91 {
92 $start1 = $this->getPosOfPlaceholder($html, $start_tag);
93 if (is_int($start1)) {
94 $end1 = $this->getEndPosOfPlaceholder($html, $start1);
95 $param_str = $this->getPlaceholderParamString($html, $start_tag);
96 $end_tag_with_params = str_replace($start_tag . ";", $end_tag . ";", $param_str);
97 $start2 = $this->getPosOfPlaceholder($html, $end_tag_with_params);
98 if (is_int($end1) && is_int($start2)) {
99 $end2 = $this->getEndPosOfPlaceholder($html, $start2);
100 if (is_int($end2)) {
101 return substr($html, 0, $start1) .
102 $replacement .
103 substr($html, $end2);
104 }
105 }
106 }
107 return null;
108 }

References ILIAS\COPage\Html\TransformUtil\getEndPosOfPlaceholder(), ILIAS\COPage\Html\TransformUtil\getPlaceholderParamString(), and ILIAS\COPage\Html\TransformUtil\getPosOfPlaceholder().

+ Here is the call graph for this function:

Field Documentation

◆ PH_END

const ILIAS\COPage\Html\TransformUtil::PH_END = "}}}}}"
protected

Definition at line 29 of file TransformUtil.php.

◆ PH_START

const ILIAS\COPage\Html\TransformUtil::PH_START = "{{{{{"
protected

Definition at line 28 of file TransformUtil.php.


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