OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : $methodProperty; } else if ($methodPrefix == 'set') { $this->$methodProperty = $args[0]; } } private function randomName($length = 10) { return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length); } public function render() { if (!ReadMore::allowRender($this)) { return $this->getToggleContent(); } $rel = 'yrm-'.esc_attr($this->randomName(5)); $this->setRel($rel); $data = $this->includeData(); $data .= $this->includeScripts(); $loadDataAction = array( 'isAdmin' => is_admin() ); do_action('readMoreLoaded', $loadDataAction); return $data; } private function includeData(){ $allContent = ''; $id = $this->getId(); $data = $this->getData(); $buttonData = $this->buttonContent(); $accordionContent = $this->accordionContent(); if(isset($data['vertical']) && $data['vertical'] == 'top') { $allContent = $buttonData.$accordionContent; return $allContent; } $allContent = $accordionContent.$buttonData; return apply_filters('ycdReadMoreFinalContent', $allContent, $data, $id); } private function accordionContent() { $rel = $this->getRel(); $id = $this->getId(); $dataObj = $this->getDataObj(); $data = $this->getData(); $tag = 'div'; $hideClassName = 'yrm-content-hide'; $showStatus = 'false'; $inlineStyles = 'visibility: hidden;height: 0;'; $inline = @$dataObj->getOptionValue('add-button-next-content'); if(!empty($inline)) { $tag = 'span'; } if(!empty($data['default-show-hidden-content'])) { $inlineStyles = ''; $hideClassName = ''; $showStatus = 'true'; } $dataAfterAction = $dataObj->getOptionValue('load-data-after-action'); $inlineHidden = ''; if (!empty($dataObj->getOptionValue('add-button-next-content'))) { $inlineHidden = 'yrm-inline-content'; } $content = $this->filterToggleContent(); return "<$tag class='yrm-content yrm-content-".esc_attr($id)." ".esc_attr($hideClassName)." ".esc_attr($inlineHidden)."' id='".esc_attr($rel)."' data-id='".esc_attr($id)."' data-show-status='".esc_attr($showStatus)."' data-after-action='".esc_attr($dataAfterAction)."' style=\"$inlineStyles\"> <$tag id='yrm-inner-content-$rel' class='yrm-inner-content-wrapper yrm-cntent-".esc_attr($id)."'>$content$tag> $tag>"; } private function filterToggleContent() { $content = $this->getToggleContent(); if (YRM_PKG == YRM_FREE_PKG) { return $content; } $dataObj = $this->getDataObj(); $dataAfterAction = $dataObj->getOptionValue('load-data-after-action'); if (!empty($dataAfterAction)) { $id = $this->getId(); $rel = $this->getRel(); ReadMoreAdminHelperPro::saveHiddenContent($id, $rel, $content); $content = ''; } return $content; } private function buttonContent() { $data = $this->getData(); $dataObj = $this->getDataObj(); $mode = $dataObj->getOptionvalue('yrm-dimension-mode'); $modeClassName = ''; $textWrapperClass = 'yrm-text-wrapper-custom-dimensions'; if($mode == 'autoMode') { $textWrapperClass = ''; $modeClassName = 'yrm-button-auto-mode'; } $id = $this->getId(); $rel = $this->getRel(); $more = __('Read More', YRM_LANG); $lessName = __('Read Less', YRM_LANG); if (!empty($data['more-button-title'])) { $more = $data['more-button-title']; } if (!empty($data['attrMoreName'])) { $more = $data['attrMoreName']; } if (!empty($data['less-button-title'])) { $lessName = $data['less-button-title']; } if (!empty($data['attrLessName'])) { $lessName = $data['attrLessName']; } $type = $data['type']; $moreTitle = @$data['more-title']; $lessTitle = @$data['less-title']; $enableTooltip = (!empty($data['enable-tooltip'])) ? $data['enable-tooltip']: ''; $tooltipText = (!empty($data['enable-tooltip-text'])) ? $data['enable-tooltip-text']: ''; $buttonLabel = $more; if(!empty($data['default-show-hidden-content'])) { $buttonLabel = $lessName; } $moreButtonClassName = $dataObj->getOptionvalue('yrm-more-button-custom-class'); $lessButtonClassName = $dataObj->getOptionvalue('yrm-less-button-custom-class'); $tooltipWrapperClass = ''; if (!empty($enableTooltip)) { $tooltipWrapperClass .= ' yrm-tooltip'; } $button = ""; $inlineTypes = array('inline', 'inlinePopup', 'alink'); $inlineTypes = apply_filters('yrmInlineTypes', $inlineTypes); if(in_array($type, $inlineTypes)) { $tag = 'div'; $inlineClass = ''; $inline = $dataObj->getOptionValue('add-button-next-content'); if(!empty($inline)) { $tag = 'span'; $inlineClass = 'yrm-btn-inline'; } $button = "<$tag class='yrm-btn-wrapper yrm-inline-wrapper yrm-btn-wrapper-".esc_attr($id)." ".esc_attr($inlineClass)." yrm-more-button-wrapper ".esc_attr($tooltipWrapperClass)."'>"; if($dataObj->getOptionvalue('show-content-gradient')) { $button .= "<".esc_attr($tag)." class='yrm-content-gradient-".esc_attr($id)." yrm-content-gradient'>".esc_attr($tag).">"; } $button .= "'; $button .= "$tag>"; } return $button; } private function includeScripts() { global $includeIds; $id = $this->getId(); $savedData = $this->getData(); $dataObj = $this->getDataObj(); $savedData['sound-url'] = $dataObj->getOptionValue('yrm-button-click-sound'); $type = $savedData['type']; $scripts = ''; $scripts .= ''; $scripts .= $this->includeCustomStyle(); $footerAction = 'wp_footer'; if(is_admin()) { $footerAction= 'admin_footer'; } if (!isset($includeIds)) { $includeIds = array(); } if (in_array($id, $includeIds)) { $scripts = ''; }else { array_push($includeIds, $id); } add_action($footerAction, function() use ($scripts, $id) { echo $scripts; }); } public function includeCustomStyle() { $styles = ''; $id = $this->getId(); $savedData = $this->getData(); $type = $savedData['type']; $dataObj = $this->getDataObj(); $important = '!important'; if(is_admin()) { $important = ''; } $hiddenContentPadding = (int)$dataObj->getOptionValue('hidden-content-padding').'px'; $hiddenFontFamily = $dataObj->getOptionValue('hidden-content-font-family'); $cursor = $dataObj->getOptionValue('yrm-cursor'); if ($hiddenFontFamily == 'customFont') { $hiddenFontFamily = $dataObj->getOptionValue('hidden-content-custom-font-family'); } $hiddenContentAlign = $dataObj->getOptionValue('hidden-content-align'); $styles .= ''; if(!empty($dataObj->getOptionValue('enable-tooltip'))) { $styles .= ''; } $styles = apply_filters('yrmContentStyles', $styles, $dataObj, $id); return $styles; } private function getButtonIcon($dataObj, $position) { $button = ''; $enableIcon = false; if(YRM_PKG > 1) { $enableIcon = $dataObj->getOptionvalue('enable-button-icon'); } if(!empty($enableIcon) && $dataObj->getOptionvalue('arrow-icon-alignment') === $position) { $button .= ""; } return $button; } private function getToolTipContent($text = '') { $id = $this->getId(); return ''.esc_attr($text).''; } }