public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) {
        switch ($mode) {
            case self::TRIM_RIGHT :
                if (core_text::strlen($node->text)>($long+3)) {
                    // Truncate the text to $long characters
                    $node->text = $this->trim_right($node->text, $long);
                }
                if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
                    // Truncate the shorttext
                    $node->shorttext = $this->trim_right($node->shorttext, $short);
                }
                break;
            case self::TRIM_LEFT :
                if (core_text::strlen($node->text)>($long+3)) {
                    // Truncate the text to $long characters
                    $node->text = $this->trim_left($node->text, $long);
                }
                if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
                    // Truncate the shorttext
                    $node->shorttext = $this->trim_left($node->shorttext, $short);
                }
                break;
            case self::TRIM_CENTER :
                if (core_text::strlen($node->text)>($long+3)) {
                    // Truncate the text to $long characters
                    $node->text = $this->trim_center($node->text, $long);
                }
                if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
                    // Truncate the shorttext
                    $node->shorttext = $this->trim_center($node->shorttext, $short);
                }
                break;
        }
        if ($recurse && $node->children->count()) {
            foreach ($node->children as &$child) {
                $this->trim($child, $mode, $long, $short, true);
            }
        }
    }
public function trim(navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) {
        switch ($mode) {
            case self::TRIM_RIGHT :
                if (core_text::strlen($node->text)>($long+3)) {
                    // Truncate the text to $long characters
                    $node->text = $this->trim_right($node->text, $long);
                }
                if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
                    // Truncate the shorttext
                    $node->shorttext = $this->trim_right($node->shorttext, $short);
                }
                break;
            case self::TRIM_LEFT :
                if (core_text::strlen($node->text)>($long+3)) {
                    // Truncate the text to $long characters
                    $node->text = $this->trim_left($node->text, $long);
                }
                if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
                    // Truncate the shorttext
                    $node->shorttext = $this->trim_left($node->shorttext, $short);
                }
                break;
            case self::TRIM_CENTER :
                if (core_text::strlen($node->text)>($long+3)) {
                    // Truncate the text to $long characters
                    $node->text = $this->trim_center($node->text, $long);
                }
                if (is_string($node->shorttext) && core_text::strlen($node->shorttext)>($short+3)) {
                    // Truncate the shorttext
                    $node->shorttext = $this->trim_center($node->shorttext, $short);
                }
                break;
        }
        if ($recurse && $node->children->count()) {
            foreach ($node->children as &$child) {
                $this->trim($child, $mode, $long, $short, true);
            }
        }
    }
public function trim ( navigation_node $ node , $ mode = 1 , $ long = 50 , $ short = 25 , $ recurse = true ) { switch ( $ mode ) { case self :: TRIM_RIGHT : if ( core_text :: strlen ( $ node -> text ) > ( $ long + 3 ) ) { // Truncate the text to $long characters $ node -> text = $ this -> trim_right ( $ node -> text , $ long ) ; } if ( is_string ( $ node -> shorttext ) && core_text :: strlen ( $ node -> shorttext ) > ( $ short + 3 ) ) { // Truncate the shorttext $ node -> shorttext = $ this -> trim_right ( $ node -> shorttext , $ short ) ; } break ; case self :: TRIM_LEFT : if ( core_text :: strlen ( $ node -> text ) > ( $ long + 3 ) ) { // Truncate the text to $long characters $ node -> text = $ this -> trim_left ( $ node -> text , $ long ) ; } if ( is_string ( $ node -> shorttext ) && core_text :: strlen ( $ node -> shorttext ) > ( $ short + 3 ) ) { // Truncate the shorttext $ node -> shorttext = $ this -> trim_left ( $ node -> shorttext , $ short ) ; } break ; case self :: TRIM_CENTER : if ( core_text :: strlen ( $ node -> text ) > ( $ long + 3 ) ) { // Truncate the text to $long characters $ node -> text = $ this -> trim_center ( $ node -> text , $ long ) ; } if ( is_string ( $ node -> shorttext ) && core_text :: strlen ( $ node -> shorttext ) > ( $ short + 3 ) ) { // Truncate the shorttext $ node -> shorttext = $ this -> trim_center ( $ node -> shorttext , $ short ) ; } break ; } if ( $ recurse && $ node -> children -> count ( ) ) { foreach ( $ node -> children as & $ child ) { $ this -> trim ( $ child , $ mode , $ long , $ short , true ) ; } } }
Trims the text and shorttext properties of this node and optionally
all of its children.

@param navigation_node $node
@param int $mode One of navigation_node::TRIM_*
@param int $long The length to trim text to
@param int $short The length to trim shorttext to
@param bool $recurse Recurse all children
Trims the text and shorttext properties of this node and optionally all of its children .