Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_jdonation/libraries/osf/form/field/checkboxes.php
Ðазад
<?php use Joomla\CMS\Factory; /** * Form Field class for the Joomla OSF. * Supports a checkbox list custom field. * * @package Joomla.OSF * @subpackage Form */ class OSFFormFieldCheckboxes extends OSFFormField { /** * The form field type. * * @var string * */ protected $type = 'Checkboxes'; /** * Options for checkbox lists * @var array */ protected $options = array(); /** * Number options displayed perrow * @var int */ protected $optionsPerRow = 1; /** * Method to instantiate the form field object. * * @param JTable $row the table object store form field definitions * @param mixed $value the initial value of the form field * */ public function __construct($row, $value) { parent::__construct($row, $value); if ((int) $row->size) { $this->optionsPerRow = (int) $row->size; } if (is_array($row->values)) { $this->options = $row->values; } elseif (strpos($row->values, "\r\n") !== FALSE) { $this->options = explode("\r\n", $row->values); } else { $this->options = explode(",", $row->values); } } /** * Method to get the field input markup. * * @return string The field input markup. * */ protected function getInput($bootstrapHelper = null) { $html = array(); $options = $this->options; $attributes = $this->buildAttributes(); if (is_array($this->value)) { $selectedOptions = $this->value; } elseif (strpos($this->value, "\r\n")) { $selectedOptions = explode("\r\n", $this->value); } elseif (is_string($this->value) && is_array(json_decode($this->value))) { $selectedOptions = json_decode($this->value); } else { $selectedOptions = array($this->value); } $html[] = '<fieldset id="' . $this->name . '" class="row-fluid clearfix"' . '>'; $html[] = '<ul class="clearfix">'; $i = 0; $optionsPerRow = (int) $this->optionsPerRow; $span = intval(12 / $optionsPerRow); if((int) $span == 0) { $span = 12; } if(Factory::getApplication()->isClient('administrator')) { $extraCss = " style='display:block;'"; } else { $extraCss = ""; } $numberOptions = count($options); foreach ($options as $option) { $i++; $optionValue = trim($option); if($optionValue != '') { $checked = in_array($optionValue, $selectedOptions) ? 'checked' : ''; } else { $checked = ''; } $html[] = '<li class="span' . $span . '" '.$extraCss.'>'; $html[] = '<label class="checkbox" for="' . $this->name . $i . '" >'; $html[] = '<input type="checkbox" id="' . $this->name . $i . '" name="' . $this->name . '[]" value="' . htmlspecialchars($optionValue, ENT_COMPAT, 'UTF-8') . '"' . $checked . $attributes . $this->extraAttributes . '/>'.$option; $html[] = '</label>'; $html[] = '</li>'; if ($i % $optionsPerRow == 0 && $i < $numberOptions) { $html[] = '</ul>'; $html[] = '<ul class="clearfix">'; } } $html[] = '</ul>'; // End the checkbox field output. $html[] = '</fieldset>'; return implode($html); } /** * Method to get the field input markup. * * @return string The field input markup. * */ protected function getInputSimple($bootstrapHelper = null,$field, $controlGroupAttributes, $campaignId = 0) { $config = DonationHelper::getConfig(); $html = array(); $options = $this->options; $attributes = $this->buildAttributes(); if (is_array($this->value)) { $selectedOptions = $this->value; } elseif (strpos($this->value, "\r\n")) { $selectedOptions = explode("\r\n", $this->value); } elseif (is_string($this->value) && is_array(json_decode($this->value))) { $selectedOptions = json_decode($this->value); } else { $selectedOptions = array($this->value); } if($campaignId > 0) { $campaignClass = 'campaign_'.$campaignId . ' '; } $html[] = '<fieldset id="' . $this->name . '" class="row-fluid clearfix"' . ' '.$controlGroupAttributes.' '.$campaignClass.'>'; $html[] = $field->title; if($field->description && $config->display_field_description == 'above_field') { $html[] = '<div class="clearfix '.$bootstrapHelper->getClassMapping('row-fluid').'">'; $html[] = '<div class="clearfix '.$bootstrapHelper->getClassMapping('span12').' fielddescription">'; $html[] = $field->description; $html[] = '</div>'; $html[] = '</div>'; } $html[] = '<ul class="clearfix '.$bootstrapHelper->getClassMapping('row-fluid').' checkboxfields">'; $i = 0; $optionsPerRow = (int) $this->optionsPerRow; $span = intval(12 / $optionsPerRow); $numberOptions = count($options); $spanClass = $bootstrapHelper->getClassMapping('span'.$span); foreach ($options as $option) { $i++; $optionValue = trim($option); $checked = in_array($optionValue, $selectedOptions) ? 'checked' : ''; $html[] = '<li class="' . $spanClass . '">'; $html[] = '<label class="checkbox" for="' . $this->name . $i . '" >'; $html[] = '<input type="checkbox" id="' . $this->name . $i . '" name="' . $this->name . '[]" value="' . htmlspecialchars($optionValue, ENT_COMPAT, 'UTF-8') . '"' . $checked . $attributes . $this->extraAttributes . '/>'.$option; $html[] = '</label>'; $html[] = '</li>'; if ($i % $optionsPerRow == 0 && $i < $numberOptions) { $html[] = '</ul>'; $html[] = '<ul class="clearfix '.$bootstrapHelper->getClassMapping('row-fluid').' checkboxfields">'; } } $html[] = '</ul>'; if($field->description && $config->display_field_description == 'under_field') { $html[] = '<div class="clearfix '.$bootstrapHelper->getClassMapping('row-fluid').'">'; $html[] = '<div class="clearfix '.$bootstrapHelper->getClassMapping('span12').' fielddescription">'; $html[] = $field->description; $html[] = '</div>'; $html[] = '</div>'; } // End the checkbox field output. $html[] = '</fieldset>'; return implode($html); } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка