/var/www/html/wp-content/plugins/expand-maker/files/

OS : Linux

PHP Version : 7.4.33

Software : Apache/2.4.6 (CentOS) PHP/7.4.33

Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64setButtonsData($buttonsData); $this->setSavedValue($savedValue); $this->prepareBuild(); } public function __toString() { return $this->render(); } public function setButtonsData($buttonsData) { $this->buttonsData = $buttonsData; } public function getButtonsData() { return $this->buttonsData; } /** * Radio buttons saved value * * @since 2.2.0 * * @param string $savedValue */ public function setSavedValue($savedValue) { $this->savedValue = $savedValue; } public function getSavedValue() { return $this->savedValue; } /** * Radio buttons template * * @since 2.2.0 * * @param array $template */ public function setTemplate($template) { $this->template = $template; } public function getTemplate() { return $this->template; } /** * Radio buttons position * * @since 2.2.0 * * @param string $buttonPosition */ public function setButtonPosition($buttonPosition) { $this->buttonPosition = $buttonPosition; } public function getButtonPosition() { return $this->buttonPosition; } /** * Fields Data * * @since 2.2.0 * * @param array $fields */ public function setFields($fields) { $this->fields = $fields; } public function getFields() { return $this->fields; } private function prepareBuild() { $buttonsData = $this->getButtonsData(); if(!empty($buttonsData['template'])) { $this->setTemplate($buttonsData['template']); } if(!empty($buttonsData['buttonPosition'])) { $this->setButtonPosition($buttonsData['buttonPosition']); } if(!empty($buttonsData['fields'])) { $this->setFields($buttonsData['fields']); } } public function render() { $allowedTag = ReadMoreAdminHelper::getAllowedTags(); ob_start(); ?>

renderFields(), $allowedTag)?>
getFields(); $groupAttrStr = ''; $template = $this->getTemplate(); $buttonPosition = $this->getButtonPosition(); $buttonsView = ''; if(empty($fields)) { return $buttonsView; } if(!empty($template['groupWrapperAttr'])) { $groupAttrStr = $this->createAttrs($template['groupWrapperAttr']); } foreach($fields as $field) { $labelView = $this->createLabel($field); $radioButton = $this->createRadioButton($field); $buttonsView .= "
"; if($buttonPosition == 'right') { $buttonsView .= $labelView.$radioButton; } else { $buttonsView .= $radioButton.$labelView; } $buttonsView .= '
'; } return $buttonsView; } private function createRadioButton($field) { $template = $this->getTemplate(); $savedValue = $this->getSavedValue(); $parentAttrsStr = ''; $inputAttrStr = ''; $value = ''; $checked = ''; if(!empty($template['fieldWrapperAttr'])) { $parentAttrsStr = $this->createAttrs($template['fieldWrapperAttr']); } if(!empty($field['attr'])) { if(!empty($field['attr']['value'])) { $value = $field['attr']['value']; } $inputAttrStr = $this->createAttrs($field['attr']); } if($savedValue == $value) { $checked = 'checked'; } $label = "
"; $label .= ""; $label .= '
'; return $label; } private function createLabel($field) { $template = $this->getTemplate(); $parentAttrsStr = ''; $label = ''; $value = ''; $labelName = ''; if(empty($field['label'])) { return $label; } if(!empty($field['attr']['value'])) { $value = $field['attr']['value']; } $labelData = $field['label']; if(!empty($template['labelAttr'])) { $parentAttrsStr = $this->createAttrs($template['labelAttr']); } if (!empty($labelData['name'])) { $labelName = $labelData['name']; } $label = "
"; $label .= ""; $label .= '
'; return $label; } /** * Create html attrs * * @since 2.2.0 * * @param array $attrs * * @return string $attrStr */ private function createAttrs($attrs) { $attrStr = ''; if (empty($attrs)) { return $attrStr; } foreach ($attrs as $attrKey => $attrValue) { $attrStr .= $attrKey.'="'.esc_attr($attrValue).'" '; } return $attrStr; } }