You are here

function mp3player_encodeSource in MP3 Player 7.2

Same name and namespace in other branches
  1. 6.2 mp3player.module \mp3player_encodeSource()
  2. 6 mp3player.module \mp3player_encodeSource()

Encode a URL.

1 call to mp3player_encodeSource()
theme_mp3player in ./mp3player.module
Setup theme function for the MP3 Player.

File

./mp3player.module, line 685
mp3player main module file.

Code

function mp3player_encodeSource($string) {
  $ntexto = "";
  $codekey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
  for ($i = 0; $i < strlen($string); $i++) {
    $ntexto .= substr("0000" . base_convert(ord($string[$i]), 10, 2), -8);
  }
  $ntexto .= substr("00000", 0, 6 - strlen($ntexto) % 6);
  $string = "";
  for ($i = 0; $i < strlen($ntexto) - 1; $i = $i + 6) {
    $string .= $codekey[intval(substr($ntexto, $i, 6), 2)];
  }
  return $string;
}