You are here

protected function ShortURLMigration::shortUrlDecode in ShURLy 7

Encode number (index of the URL) into url using alpha-numeric mapping (basically copied from shorturl.module)

File

shurly_migration/shurly_migration.migrate.inc, line 62

Class

ShortURLMigration
Class ShortURLMigration migrates from Shurly Drupal 6 module

Code

protected function shortUrlDecode($lid) {
  $mapping = $this
    ->shorturl_base_encode_mapping();
  $lid = $this
    ->shorturl_base_encode($lid, sizeof($mapping));
  $arr = preg_split('/-/', $lid);
  if (empty($arr)) {
    return $mapping[0];
  }
  if (!is_array($arr)) {
    $arr = array(
      $arr,
    );
  }
  $new_num = "";
  foreach ($arr as $pos) {
    $new_num .= $mapping[(int) trim($pos)];
  }
  return $new_num;
}