Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezrandomtranslator.php
Go to the documentation of this file.
1 <?php
18 class eZRandomTranslator extends eZTranslatorGroup
19 {
20 public function __construct( $is_key_based )
21 {
22 parent::__construct( $is_key_based );
23 mt_srand();
24 }
25
29 function keyPick( $key )
30 {
31 if ( $this->handlerCount() == 0 )
32 return -1;
33 return mt_rand( 0, $this->handlerCount() - 1 );
34 }
35
39 function pick( $context, $source, $comment )
40 {
41 if ( $this->handlerCount() == 0 )
42 return -1;
43 return mt_rand( 0, $this->handlerCount() - 1 );
44 }
45 }
46
47 ?>
eZRandomTranslator
Translates text by picking randomly among it's sub handlers.
Definition: ezrandomtranslator.php:19
eZRandomTranslator\__construct
__construct( $is_key_based)
Definition: ezrandomtranslator.php:20
eZRandomTranslator\pick
pick( $context, $source, $comment)
Definition: ezrandomtranslator.php:39
eZRandomTranslator\keyPick
keyPick( $key)
Definition: ezrandomtranslator.php:29
eZTranslatorGroup
Allows for picking translator handlers according to context.
Definition: eztranslatorgroup.php:19
eZTranslatorGroup\handlerCount
handlerCount()
Definition: eztranslatorgroup.php:123
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.