Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Static Public Member Functions | List of all members
eZTextTool Class Reference

## Static Public Member Functions
static | nl2br ( $string, $xhtml=true)
static | addPre ( $string, $char=">")
static | capitalize ( $string, $bigClass="h1bigger")
static | boolText ( $value)
static | htmlspecialchars ( $string)
static | fixhtmlentities ( $string)
static | lineSplit ( $in, $len=0, $size=72)
static | parseXML (&$xml, $inline_children=false)
static | parseXMLPart (&$xml, &$msg, $inline_children)

## Detailed Description

! eZCommon The eZTextTool class provides text utility functions

This class consists of static functions for formatting of text. Theese functions is made as an extention to PHP ie functions you would use all the time, but isn't a part of php.

Example of usage:

// create a string with newlines
$text = "This is
a
text
to break
up";
// convert the newlines to xhtml breaks
$text = eZTextTool::nl2br( $text );
//print out the result
print( $text );
eZTextTool\nl2br
static nl2br( $string, $xhtml=true)
Definition: eztexttool.php:65

Definition at line 54 of file eztexttool.php.

## Member Function Documentation

## ◆ addPre()

static eZTextTool::addPre | ( |  | $string,
|  |  | $char = `">"`
| ) |  |
| static

This function will add a > at the beginning of each line.

Definition at line 83 of file eztexttool.php.

## ◆ boolText()

static eZTextTool::boolText | ( |  | $value | ) |
| static

This function will return the text "true" if the input value is true and the text "false" if false.

Definition at line 135 of file eztexttool.php.

## ◆ capitalize()

static eZTextTool::capitalize | ( |  | $string,
|  |  | $bigClass = `"h1bigger"`
| ) |  |
| static

This function will convert text into capitilzed text.

Numbers will not be capitalized. E.g.

"a text string" will be converted to "A T E X T S T R I N G" Where the first letter in each word will get the css style; span with class="$bigClass" given as argument.

Definition at line 105 of file eztexttool.php.

References $i.

## ◆ fixhtmlentities()

static eZTextTool::fixhtmlentities | ( |  | $string | ) |
| static

Fixup error made by htmlspecialchars, will convert for instance &#8364; back to &#8364; (euro symbol)

Definition at line 156 of file eztexttool.php.

Referenced by eZArticle\authorText(), eZImage\caption(), eZArticleCategory\description(), eZImage\description(), eZImageCategory\description(), eZArticle\linkText(), eZArticle\name(), eZArticleCategory\name(), eZImage\name(), eZImageCategory\name(), and eZAuthor\name().

## ◆ htmlspecialchars()

static eZTextTool::htmlspecialchars | ( |  | $string | ) |
| static

Performs a normal htmlspecialchars with a striplashes afterwards, this is needed to avoid " and \ being slashed on web pages.

Definition at line 144 of file eztexttool.php.

Referenced by eZList\drawList().

## ◆ lineSplit()

static eZTextTool::lineSplit | ( |  | $in,
|  |  | $len = `0`,
|  |  | $size = `72`
| ) |  |
| static

This function will split a string into lines of no more than a given number of characters, but wont split a word. Useful in e-mails. Each new line will be ended with a "\n".

You can also add a padding length, if you wish.

Definition at line 169 of file eztexttool.php.

References $i, $size, and $tmp.

## ◆ nl2br()

static eZTextTool::nl2br | ( |  | $string,
|  |  | $xhtml = `true`
| ) |  |
| static

This function converts all newlines
into breaks.

The breaks are inserted before every newline.

The default is to use xhtml breaks, html breaks is used if the $xhtml variable is set to false.

Definition at line 65 of file eztexttool.php.

Referenced by eZQDomRenderer\renderChildren(), eZQDomRenderer\renderCustom(), eZEzRenderer\renderIntro(), eZSimpleRenderer\renderIntro(), eZSimpleRenderer\renderPage(), eZEzRenderer\renderPage(), eZTechRenderer\renderPlain(), eZQDomRenderer\renderPlain(), and eZQDomRenderer\renderStandards().

## ◆ parseXML()

static eZTextTool::parseXML | ( | & | $xml,
|  |  | $inline_children = `false`
| ) |  |
| static

Parses an XML message into a tree array, the XML needs to be passed trough qdom_tree or xml_tree before being passed to this function. This function is useful for small xml files with 1-3 levels. The resulting array tree makes it easy to grab variables from the XML tree. Each node gets a separate array with each attribute as a key/value pair, each child of that node is a key with the node name and the value is the new tree. If $inline_children is set to true then no "children" elements are created, the subnodes will instead be placed directly in the current node. Example: <top attrib="test"><one src="test again" ></top> Result: Array ( [top] => Array ( [attrib] => test [children] => Array ( [one] => Array ( [src] => test again ) ) ) ) You can then access the "src" attribute of the node "one" by doing, $src = $tree["top"]["children"]["one"]["src"]; which is quite easier than traversing an xml tree manually.

Definition at line 220 of file eztexttool.php.

References $msg, and parseXMLPart().

## ◆ parseXMLPart()

static eZTextTool::parseXMLPart | ( | & | $xml,
|  | & | $msg,
|  |  | $inline_children
| ) |  |
| static

Helper function for parseXML.

Definition at line 232 of file eztexttool.php.

References $msg, and $part.

Referenced by parseXML().

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

- eztexttool.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.