.pdf)
WHM Plugins
$meta_info hash ref:
install_fields will build your install form to make sure the input you need exists. Here, you can add your extra fields for text, radio buttons, etc. This hashref is used to build the input fields. Here are some guidelines:
[% input_NAME %] where "=NAME=" is the key.
[% input_NAME %] [% input_NAME-0 %] [% input_NAME-1 %], etc.
install_fields_hook =>
'install_fields' => {
'test_text' => {
'label' => 'Text',
'value' => 'text value',
'attr' => 'size="32"',
'type' => 'text',
},
'test_hidden' => {
'label' => 'Hidden',
'value' => 'Hidden value',
'attr' => 'attr="2"',
'type' => 'hidden',
},
'test_password' => {
'label' => 'Password',
'value' => 'password value',
'attr' => 'size="10"',
'type' => 'password'
},
'test_textarea' => {
'label' => 'Text Area',
'value' => 'textarea text',
'attr' => 'cols="51"',
'type' => 'textarea',
},
'test_select' => {
'label' => 'Select',
'value' => { foo => 'FOo', bar=> 'Bar' },
'attr' => '',
'type' => 'select',
'defvalue' => 'bar',
},
'test_radio' => {
'label' => 'Radio',
'value' => { 1=> 'One', 2=> 'Two', 3=>'Three'},
'attr' => '',
'type' => 'radio',
'defvalue' => '2',
},
'test_multi' => {
'label' => 'Multi',
'value' => {4=>'Four',5=>'Five',6=>'Siz',7=>'Seven'},
'attr' => 'size="2"',
'type' => 'multi',
'defvalue' => [5,7],
},
'test_checkbox' => {
'label' => 'Checkbox',
'value' => {8=>'Eight',9=>'Nine',10=>'Ten',11=>'Eleven'},
'attr' => '',
'type' => 'checkbox',
'defvalue' => [8,11],
},
},
install_fields_hook when using install_fields. The install_fields_hook checks input from the form generated using install_fields. It should be modified to make sure input is parsed properly and will not corrupt your configuration or MySQL files. Failure to properly evaluate and escape this input may result in a broken installation.
If you need to modify any input, you will need to modify $obj->{'input_whatever'} since the object key is used as a config variable. Changing $input_hr->{'whatever'} will have no effect on what gets put into the install.
'install_fields_hook' => sub {
my ($input_hr, $error_hr, $obj)= @_;
# escape single quotes so it doesn't break the
# single quoted value in the config file (= '[% install_foo %]';)
$obj->{'input_foo'} =~ s{'}{\\'}g;
# check $input_hr and if there are problems set the error like so:
print "Checking your laces...<br />\n";
${$error_hr} = "Your shoes are untied, try again"
if !_laces_are_tied_tight($input_hr->{'shoes'});
},
Copyright © cPanel 2000–2011.