Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

eztexttool.php
Go to the documentation of this file.
1 <?php
18 class eZTextTool
19 {
25 function highlightHTML( $input )
26 {
27 $input = str_replace( "<", "&lt;", $input );
28 $input = str_replace( ">", "&gt;", $input );
29
30 $input = preg_replace( "#&lt;(.*?)&gt;#m", "<font color='red'>&lt;$1&gt;</font>", $input );
31
32 return $input;
33 }
34
35 function highlightPHP()
36 {
37
38 }
39
40 function concatDelimited()
41 {
42 $numargs = func_num_args();
43 $argList = func_get_args();
44 $text = null;
45 if ( $numargs > 1 )
46 {
47 $delimit = $argList[0];
48 $text = implode( $delimit, eZTextTool::arrayFlatten( array_splice( $argList, 1 ) ) );
49 }
50 return $text;
51 }
52
53 function concat()
54 {
55 $numargs = func_num_args();
56 $argList = func_get_args();
57 $text = null;
58 if ( $numargs > 0 )
59 {
60 $text = implode( '', eZTextTool::arrayFlatten( $argList ) );
61 }
62 return $text;
63 }
64
65 function arrayFlatten( $array )
66 {
67 $flatArray = array();
68 $expandItems = $array;
69 $done = false;
70 while ( !$done )
71 {
72 $checkList = $expandItems;
73 $leftOvers = array();
74 $foundArray = false;
75 foreach ( array_keys( $checkList ) as $key )
76 {
77 $item = $checkList[$key];
78 if ( is_array ( $item ) )
79 {
80 $leftOvers = array_merge( $leftOvers, $item );
81 $foundArray = true;
82 }
83 else
84 {
85 if ( $foundArray )
86 $leftOvers[] = $item;
87 else
88 $flatArray[] = $item;
89 }
90 }
91 $expandItems = $leftOvers;
92 if ( count( $expandItems ) == 0 )
93 {
94 $done = true;
95 }
96 }
97 return $flatArray;
98 }
99 }
100 ?>
eZTextTool
eZTextTool is a class with different useful text functions
Definition: eztexttool.php:19
eZTextTool\highlightPHP
highlightPHP()
Definition: eztexttool.php:35
eZTextTool\arrayFlatten
arrayFlatten( $array)
Definition: eztexttool.php:65
eZTextTool\concat
concat()
Definition: eztexttool.php:53
eZTextTool\concatDelimited
concatDelimited()
Definition: eztexttool.php:40
eZTextTool\highlightHTML
highlightHTML( $input)
Definition: eztexttool.php:25
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.