You are here

private function ShortURLMigration::shorturl_base_encode in ShURLy 7

Convert $var from (10) base notation to $base base notation.

1 call to ShortURLMigration::shorturl_base_encode()
ShortURLMigration::shortUrlDecode in shurly_migration/shurly_migration.migrate.inc
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 83

Class

ShortURLMigration
Class ShortURLMigration migrates from Shurly Drupal 6 module

Code

private function shorturl_base_encode($var, $base) {

  // return string, accept two integers
  if ($var < $base) {

    // see if it's time to return
    return $var;
  }
  else {
    return $this
      ->shorturl_base_encode(floor($var / $base), $base) . "-" . $var % $base;

    // continue
  }
}