芝麻web文件管理V1.00
编辑当前文件:/home/projzpbv/www/wp-content/plugins/ninja-forms/includes/Admin/Metaboxes/CalculationsReact.php
isDebugSet(); // extract/construct the label/value/styling arrays $labelValueCollection = self::extractResponses($extraValue,$debug); if (!empty($labelValueCollection)) { $array = [ // Set a translatable title for your metabox 'title' => __('Calculations', 'ninja-forms'), // set the label/value/styling 'labelValueCollection' => $labelValueCollection ]; $return = \NinjaForms\Includes\Entities\MetaboxOutputEntity::fromArray($array); } return $return; } /** * Construct calculations output */ protected static function extractResponses($calculations, ?bool $debug=false ): array { // Initialize collection of label/value/styling arrays $return = []; if (is_array($calculations)) { foreach ($calculations as $name => $contents) { $result = [ 'label' => \esc_html($name), 'value' => $contents['value'] ]; $return[] = $result; if(!$debug){ continue; } $raw = [ 'label' => \esc_html($name). __(' - Raw', 'ninja-forms'), 'value' => $contents['raw'] ]; $return[] = $raw; $parsed = [ 'label' => \esc_html($name) . __(' - Parsed', 'ninja-forms'), 'value' => $contents['parsed'] ]; $return[] = $parsed; } } return $return; } /** * Determine/return if calc debug is set * * Checks for string `&calcs_debug` in URI * * @return boolean */ protected function isDebugSet( ): bool { $referer= $this->getReferer(); if(\is_null($referer)){ return FALSE; } $return = strpos($referer,'calcs_debug')>0?TRUE:FALSE; return $return; } /** * Get the input server referer * * @return mixed */ protected function getReferer( ) { $return= filter_input(INPUT_SERVER,'HTTP_REFERER'); return $return; } }