original_string: public static function get_areas($tagcollid = null, $enabledonly = false) {
          global $DB;
          $cache = cache::make('core', 'tags');
          if (($itemtypes = $cache->get('tag_area')) === false) {
              $colls = core_tag_collection::get_collections();
              $defaultcoll = reset($colls);
              $itemtypes = array();
              $areas = $DB->get_records('tag_area', array(), 'component,itemtype');
              foreach ($areas as $area) {
                  if ($colls[$area->tagcollid]->component) {
                      $area->locked = true;
                  }
                  $itemtypes[$area->itemtype][$area->component] = $area;
              }
              $cache->set('tag_area', $itemtypes);
          }
          if ($tagcollid || $enabledonly) {
              $rv = array();
              foreach ($itemtypes as $itemtype => $it) {
                  foreach ($it as $component => $v) {
                      if (($v->tagcollid == $tagcollid || !$tagcollid) && (!$enabledonly || $v->enabled)) {
                          $rv[$itemtype][$component] = $v;
                      }
                  }
              }
              return $rv;
          }
          return $itemtypes;
      }
code: public static function get_areas($tagcollid = null, $enabledonly = false) {
          global $DB;
          $cache = cache::make('core', 'tags');
          if (($itemtypes = $cache->get('tag_area')) === false) {
              $colls = core_tag_collection::get_collections();
              $defaultcoll = reset($colls);
              $itemtypes = array();
              $areas = $DB->get_records('tag_area', array(), 'component,itemtype');
              foreach ($areas as $area) {
                  if ($colls[$area->tagcollid]->component) {
                      $area->locked = true;
                  }
                  $itemtypes[$area->itemtype][$area->component] = $area;
              }
              $cache->set('tag_area', $itemtypes);
          }
          if ($tagcollid || $enabledonly) {
              $rv = array();
              foreach ($itemtypes as $itemtype => $it) {
                  foreach ($it as $component => $v) {
                      if (($v->tagcollid == $tagcollid || !$tagcollid) && (!$enabledonly || $v->enabled)) {
                          $rv[$itemtype][$component] = $v;
                      }
                  }
              }
              return $rv;
          }
          return $itemtypes;
      }
code_tokens: public static function get_areas ( $ tagcollid = null , $ enabledonly = false ) { global $ DB ; $ cache = cache :: make ( 'core' , 'tags' ) ; if ( ( $ itemtypes = $ cache -> get ( 'tag_area' ) ) === false ) { $ colls = core_tag_collection :: get_collections ( ) ; $ defaultcoll = reset ( $ colls ) ; $ itemtypes = array ( ) ; $ areas = $ DB -> get_records ( 'tag_area' , array ( ) , 'component,itemtype' ) ; foreach ( $ areas as $ area ) { if ( $ colls [ $ area -> tagcollid ] -> component ) { $ area -> locked = true ; } $ itemtypes [ $ area -> itemtype ] [ $ area -> component ] = $ area ; } $ cache -> set ( 'tag_area' , $ itemtypes ) ; } if ( $ tagcollid || $ enabledonly ) { $ rv = array ( ) ; foreach ( $ itemtypes as $ itemtype => $ it ) { foreach ( $ it as $ component => $ v ) { if ( ( $ v -> tagcollid == $ tagcollid || ! $ tagcollid ) && ( ! $ enabledonly || $ v -> enabled ) ) { $ rv [ $ itemtype ] [ $ component ] = $ v ; } } } return $ rv ; } return $ itemtypes ; }
docstring: Returns the list of areas indexed by itemtype and component
  
  @param int $tagcollid return only areas in this tag collection
  @param bool $enabledonly return only enabled tag areas
  @return array itemtype=>component=>tagarea object
docstring_tokens: Returns the list of areas indexed by itemtype and component