Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

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