/** * @param string[] ...$args * @return string|string[]|array(string => string) */ public function nl2br(...$args) { return df_call_a(function ($text) { /** @var string $result */ $text = df_normalize($text); /** обрабатываем тег <pre>, который добавляется функцией @see df_xml_output_html() */ if (!df_contains($text, '<pre class=') && !df_contains($text, '<pre>')) { $result = nl2br($text); } else { $text = str_replace("\n", '{rm-newline}', $text); $text = preg_replace_callback('#\\<pre(?:\\sclass="[^"]*")?\\>([\\s\\S]*)\\<\\/pre\\>#mui', [__CLASS__, 'nl2brCallback'], $text); $result = strtr($text, ['{rm-newline}' => '<br/>', '{rm-newline-preserve}' => "\n"]); } return $result; }, $args); }
/** * @used-by Df_Qa_Message::sections() * @param string[] $args * @return string|string[] */ function df_xml_output_plain(...$args) { return df_call_a(function ($text) { return str_replace([DF_XML_BEGIN, DF_XML_END], null, $text); }, $args); }
/** * 2016-11-13 * @param string[] $args * @return string|string[] */ function df_html_b(...$args) { return df_call_a(function ($s) { return df_tag('b', [], $s); }, $args); }
/** * 2016-08-10 * REFUND_ISSUED => RefundIssued * refund_issuED => RefundIssued * @param string[] ...$args * @return string|string[] */ function df_underscore_to_camel(...$args) { return df_call_a(function ($s) { return implode(df_ucfirst(explode('_', mb_strtolower($s)))); }, $args); }