concrete/src/Area/Area.php
final public static function get($c, $arHandle)
    {
        if (!is_object($c)) {
            return false;
        }

        $identifier = sprintf('/page/area/%s', $c->getCollectionID());
        $cache = \Core::make('cache/request');
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            $areas = $item->get();
        } else {
            $areas = array();
            $db = Database::connection();
            // First, we verify that this is a legitimate area
            $v = array($c->getCollectionID());
            $q = 'select arID, arHandle, cID, arOverrideCollectionPermissions, arInheritPermissionsFromAreaOnCID, arIsGlobal, arParentID from Areas where cID = ?';
            $r = $db->executeQuery($q, $v);
            while ($arRow = $r->FetchRow()) {
                if ($arRow['arID'] > 0) {
                    if ($arRow['arIsGlobal']) {
                        $obj = new GlobalArea($arHandle);
                    } else {
                        if ($arRow['arParentID']) {
                            $arParentHandle = self::getAreaHandleFromID($arRow['arParentID']);
                            $obj = new SubArea($arHandle, $arParentHandle, $arRow['arParentID']);
                        } else {
                            $obj = new self($arHandle);
                        }
                    }
                    $obj->setPropertiesFromArray($arRow);
                    $obj->c = $c;
                    $arRowHandle = $arRow['arHandle'];
                    $areas[$arRowHandle] = $obj;
                }
            }
            $cache->save($item->set($areas));
        }

        return isset($areas[$arHandle]) ? $areas[$arHandle] : null;
    }
final public static function get($c, $arHandle)
    {
        if (!is_object($c)) {
            return false;
        }

        $identifier = sprintf('/page/area/%s', $c->getCollectionID());
        $cache = \Core::make('cache/request');
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            $areas = $item->get();
        } else {
            $areas = array();
            $db = Database::connection();
            // First, we verify that this is a legitimate area
            $v = array($c->getCollectionID());
            $q = 'select arID, arHandle, cID, arOverrideCollectionPermissions, arInheritPermissionsFromAreaOnCID, arIsGlobal, arParentID from Areas where cID = ?';
            $r = $db->executeQuery($q, $v);
            while ($arRow = $r->FetchRow()) {
                if ($arRow['arID'] > 0) {
                    if ($arRow['arIsGlobal']) {
                        $obj = new GlobalArea($arHandle);
                    } else {
                        if ($arRow['arParentID']) {
                            $arParentHandle = self::getAreaHandleFromID($arRow['arParentID']);
                            $obj = new SubArea($arHandle, $arParentHandle, $arRow['arParentID']);
                        } else {
                            $obj = new self($arHandle);
                        }
                    }
                    $obj->setPropertiesFromArray($arRow);
                    $obj->c = $c;
                    $arRowHandle = $arRow['arHandle'];
                    $areas[$arRowHandle] = $obj;
                }
            }
            $cache->save($item->set($areas));
        }

        return isset($areas[$arHandle]) ? $areas[$arHandle] : null;
    }
final public static function get ( $ c , $ arHandle ) { if ( ! is_object ( $ c ) ) { return false ; } $ identifier = sprintf ( '/page/area/%s' , $ c -> getCollectionID ( ) ) ; $ cache = \ Core :: make ( 'cache/request' ) ; $ item = $ cache -> getItem ( $ identifier ) ; if ( ! $ item -> isMiss ( ) ) { $ areas = $ item -> get ( ) ; } else { $ areas = array ( ) ; $ db = Database :: connection ( ) ; // First, we verify that this is a legitimate area $ v = array ( $ c -> getCollectionID ( ) ) ; $ q = 'select arID, arHandle, cID, arOverrideCollectionPermissions, arInheritPermissionsFromAreaOnCID, arIsGlobal, arParentID from Areas where cID = ?' ; $ r = $ db -> executeQuery ( $ q , $ v ) ; while ( $ arRow = $ r -> FetchRow ( ) ) { if ( $ arRow [ 'arID' ] > 0 ) { if ( $ arRow [ 'arIsGlobal' ] ) { $ obj = new GlobalArea ( $ arHandle ) ; } else { if ( $ arRow [ 'arParentID' ] ) { $ arParentHandle = self :: getAreaHandleFromID ( $ arRow [ 'arParentID' ] ) ; $ obj = new SubArea ( $ arHandle , $ arParentHandle , $ arRow [ 'arParentID' ] ) ; } else { $ obj = new self ( $ arHandle ) ; } } $ obj -> setPropertiesFromArray ( $ arRow ) ; $ obj -> c = $ c ; $ arRowHandle = $ arRow [ 'arHandle' ] ; $ areas [ $ arRowHandle ] = $ obj ; } } $ cache -> save ( $ item -> set ( $ areas ) ) ; } return isset ( $ areas [ $ arHandle ] ) ? $ areas [ $ arHandle ] : null ; }
Gets the Area object for the given page and area handle.

@param Page $c
@param string $arHandle

@return Area
Gets the Area object for the given page and area handle .