Submit
Path:
~
/
/
opt
/
cloudlinux
/
alt-php53
/
root
/
usr
/
share
/
doc
/
pear
/
ConsoleTools
/
docs
/
File Content:
example_input.php
<?php /** * Example for the usage of ezcConsoleParameter class. * * @package ConsoleTools * @version 1.6.1 * @copyright Copyright (C) 2005-2010 eZ Systems AS. All rights reserved. * @license http://ez.no/licenses/new_bsd New BSD License */ require_once 'Base/src/base.php'; /** * Autoload ezc classes * * @param string $className */ function __autoload( $className ) { ezcBase::autoload( $className ); } $optionHandler = new ezcConsoleInput(); // Register simple parameter -h/--help $optionHandler->registerOption( new ezcConsoleOption( 'h', 'help' ) ); // Register complex parameter -f/--file $file = new ezcConsoleOption( 'f', 'file', ezcConsoleInput::TYPE_STRING, null, false, 'Process a file.', 'Processes a single file.' ); $optionHandler->registerOption( $file ); // Manipulate parameter -f/--file after registration $file->multiple = true; // Register another complex parameter that depends on -f and excludes -h $dir = new ezcConsoleOption( 'd', 'dir', ezcConsoleInput::TYPE_STRING, null, true, 'Process a directory.', 'Processes a complete directory.', array( new ezcConsoleOptionRule( $optionHandler->getOption( 'f' ) ) ), array( new ezcConsoleOptionRule( $optionHandler->getOption( 'h' ) ) ) ); $optionHandler->registerOption( $dir ); // Register an alias for this parameter $optionHandler->registerAlias( 'e', 'extended-dir', $dir ); // Process registered parameters and handle errors try { $optionHandler->process( array( 'example_input.php', '-h' ) ); } catch ( ezcConsoleOptionException $e ) { echo $e->getMessage(); exit( 1 ); } // Process a single parameter $file = $optionHandler->getOption( 'f' ); if ( $file->value === false ) { echo "Parameter -{$file->short}/--{$file->long} was not submitted.\n"; } elseif ( $file->value === true ) { echo "Parameter -{$file->short}/--{$file->long} was submitted without value.\n"; } else { echo "Parameter -{$file->short}/--{$file->long} was submitted with value <".var_export($file->value, true).">.\n"; } // Process all parameters at once: foreach ( $optionHandler->getOptionValues() as $paramShort => $val ) { switch ( true ) { case $val === false: echo "Parameter $paramShort was not submitted.\n"; break; case $val === true: echo "Parameter $paramShort was submitted without a value.\n"; break; case is_array( $val ): echo "Parameter $paramShort was submitted multiple times with value: <".implode(', ', $val).">.\n"; break; default: echo "Parameter $paramShort was submitted with value: <$val>.\n"; break; } } ?>
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
img
---
0755
CREDITS
229 bytes
0644
LICENSE
1570 bytes
0644
example_input.php
2705 bytes
0644
example_menu_dialog_full.php
624 bytes
0644
example_output.php
2107 bytes
0644
example_progressbar.php
3442 bytes
0644
example_progressmonitor.php
1099 bytes
0644
example_question_dialog_collection_full.php
613 bytes
0644
example_question_dialog_factory_yesno.php
461 bytes
0644
example_question_dialog_type_full.php
630 bytes
0644
example_statusbar.php
987 bytes
0644
example_table.php
2142 bytes
0644
example_table_2.php
1746 bytes
0644
tutorial.txt
24492 bytes
0644
tutorial_autoload.php
495 bytes
0644
tutorial_example_01_output_basic.php
184 bytes
0644
tutorial_example_02_output_advanced.php
657 bytes
0644
tutorial_example_03_output_options.php
755 bytes
0644
tutorial_example_04_input_basic.php
399 bytes
0644
tutorial_example_05_input_advanced.php
1133 bytes
0644
tutorial_example_06_progressbar_basic.php
271 bytes
0644
tutorial_example_07_progressbar_advanced.php
596 bytes
0644
tutorial_example_08_statusbar.php
656 bytes
0644
tutorial_example_09_table_basic.php
1088 bytes
0644
tutorial_example_10_table_advanced.php
1024 bytes
0644
tutorial_example_11_progressmonitor.php
299 bytes
0644
tutorial_example_12_input_arguments.php
1442 bytes
0644
tutorial_example_13_dialog_question.php
552 bytes
0644
tutorial_example_14_dialog_yesnoquestion.php
334 bytes
0644
tutorial_example_15_dialog_menu.php
739 bytes
0644
tutorial_example_output_targets.php
308 bytes
0644
N4ST4R_ID | Naxtarrr