function qtranxf_trim_words($text, $num_words, $more, $original_text) { global $q_config; $blocks = qtranxf_get_language_blocks($original_text); if (count($blocks) <= 1) { return $text; } $lang = $q_config['language']; $text = qtranxf_use_block($lang, $blocks, true, false); return wp_trim_words($text, $num_words, $more); }
/** when $text is already known to be string */ function qtranxf_use_language($lang, $text, $show_available = false, $show_empty = false) { $blocks = qtranxf_get_language_blocks($text); if (count($blocks) <= 1) { //no language is encoded in the $text, the most frequent case return $text; } return qtranxf_use_block($lang, $blocks, $show_available, $show_empty); }