nxs_html_to_utf8

The NextScripts: Social Networks Auto-Poster nxs html to utf8 function.

Description

nxs_html_to_utf8( $data ); 

Parameters (1)

0. $data
The data.

Usage

  1. if ( !function_exists( 'nxs_html_to_utf8' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4. // The data. 
  5. $data = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = nxs_html_to_utf8($data); 
  9.  

Defined (2)

The function is defined in the following location(s).

/nxs_functions.php  
  1. if (!function_exists('nxs_html_to_utf8')) { function nxs_html_to_utf8 ($data) {return preg_replace_callback("/\\&\\#([0-9]{3, 10})\\;/", create_function ('$matches', 'return nxs__html_to_utf8($matches[2]);'), $data); }} 
  1. if (!function_exists('nxs__html_to_utf8')) { function nxs__html_to_utf8 ($data) { if ($data > 127) { $i = 5; while (($i--) > 0) { 
  2. if ($data != ($a = $data % ($p = pow(64, $i)))) {  
  3. $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); for ($i; $i > 0; $i--) $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); break; } 
  4. }} else $ret = "&#$data;"; 
  5. return $ret; 
  6. }}