You are here

function _simplemeta_meta_calculate_fit in Simple Meta 7.2

Same name and namespace in other branches
  1. 6.2 simplemeta.module \_simplemeta_meta_calculate_fit()
  2. 7 simplemeta.module \_simplemeta_meta_calculate_fit()

Helper function. Calculate how much specific the path is.

Parameters

string $path: Page path to calculate a fit for.

Return value

int A numeric representation of how specific the path is.

1 call to _simplemeta_meta_calculate_fit()
SimplemetaEntity::save in ./simplemeta.info.inc
Permanently saves the entity.

File

./simplemeta.module, line 329
SimpleMeta module.

Code

function _simplemeta_meta_calculate_fit($path) {
  $fit = 0;
  $parts = explode('/', $path, MENU_MAX_PARTS);
  $number_parts = count($parts);
  $slashes = $number_parts - 1;
  foreach ($parts as $k => $part) {
    if ($part != '%') {
      $fit |= 1 << $slashes - $k;
    }
  }
  return $fit;
}