Index: trunk/tools/ToolserverI18N/public_html/demo/demoBase.php |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | 'demo3' => 'Undefined message (notice)', |
13 | 13 | 'demo4' => 'Undefined message (no brackets)', |
14 | 14 | 'demo5' => 'Dashboard backlink and footer line', |
| 15 | + 'demo6' => 'Utility examples', |
15 | 16 | ); |
16 | 17 | |
17 | 18 | $thisFile = basename( $_SERVER['SCRIPT_NAME'], '.php' ); |
Index: trunk/tools/ToolserverI18N/public_html/demo/demo6.php |
— | — | @@ -0,0 +1,56 @@ |
| 2 | +<?php |
| 3 | +/* Config */ |
| 4 | +require_once( 'demoBase.php' ); |
| 5 | + |
| 6 | +/* Demonstration */ |
| 7 | +// 1) Init $I18N |
| 8 | +$I18N = new TsIntuition( 'general' /* name of textdomain here */ ); |
| 9 | + |
| 10 | +// 2) Do it |
| 11 | + |
| 12 | +// Simple parentheses |
| 13 | +echo $I18N->parentheses( 'hello' ); |
| 14 | + |
| 15 | +// Variables |
| 16 | +echo '<br />' . $I18N->msg( 'toolversionstamp', array( |
| 17 | + 'variables' => array( '1.0', $I18N->dateFormatted( '2001-01-15' ) ), |
| 18 | +) ); |
| 19 | + |
| 20 | +// msgExists |
| 21 | +echo '<br />msgExists: '; |
| 22 | +var_dump( |
| 23 | + |
| 24 | + $I18N->msgExists( 'welcome' ) |
| 25 | + |
| 26 | +); |
| 27 | +var_dump( |
| 28 | + |
| 29 | + $I18N->msgExists( 'foobar' ) |
| 30 | + |
| 31 | +); |
| 32 | + |
| 33 | +// nonEmptyStr |
| 34 | +echo '<br />nonEmptyStr: '; |
| 35 | +var_dump( |
| 36 | + |
| 37 | + TsIntuitionUtil::nonEmptyStr( 'one' ) |
| 38 | + |
| 39 | +); |
| 40 | + |
| 41 | +// nonEmptyStrs |
| 42 | +echo '<br />nonEmptyStrs: '; |
| 43 | +var_dump( |
| 44 | + |
| 45 | + TsIntuitionUtil::nonEmptyStrs( 'one', '', 'three' ) |
| 46 | + |
| 47 | +); |
| 48 | +var_dump( |
| 49 | + |
| 50 | + TsIntuitionUtil::nonEmptyStrs( array( 'one', '', 'three' ) ) |
| 51 | + |
| 52 | +); |
| 53 | + |
| 54 | + |
| 55 | +/* View source */ |
| 56 | +view_source( __FILE__ ); |
| 57 | +close_demo(); |
\ No newline at end of file |
Property changes on: trunk/tools/ToolserverI18N/public_html/demo/demo6.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 58 | + native |