nsx_doEncode

The NextScripts: Social Networks Auto-Poster nsx doEncode function.

Description

nsx_doEncode( $string, (string) $key = 'NSX' ); 

Parameters (2)

0. $string
The string.
1. $key — Optional. (string) => 'NSX'
The key.

Usage

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

Defined (1)

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

/nxs_functions.php  
  1. if (!function_exists('nsx_doEncode')) { function nsx_doEncode($string, $key='NSX') { $key = sha1($key); $strLen = strlen($string);$keyLen = strlen($key); $j = 0; $hash = ''; 
  2. for ($i = 0; $i < $strLen; $i++) { $ordStr = ord(substr($string, $i, 1)); if ($j == $keyLen) $j = 0; $ordKey = ord(substr($key, $j, 1)); $j++; $hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36));} return $hash; 
  3. }}