Classes/Utility/GeneralUtility.php
public static function getRootPid($uid = null)
    {
        static $cache = array();
        $ret = null;

        if ($uid === null) {
            #################
            # Current root PID
            #################
            $rootline = self::getRootLine();
            if (!empty($rootline[0])) {
                $ret = $rootline[0]['uid'];
            }
        } else {
            #################
            # Other root PID
            #################
            if (!isset($cache[$uid])) {
                $cache[$uid] = null;
                $rootline    = self::getRootLine($uid);

                if (!empty($rootline[0])) {
                    $cache[$uid] = $rootline[0]['uid'];
                }
            }

            $ret = $cache[$uid];
        }

        return $ret;
    }
public static function getRootPid($uid = null)
    {
        static $cache = array();
        $ret = null;

        if ($uid === null) {
            #################
            # Current root PID
            #################
            $rootline = self::getRootLine();
            if (!empty($rootline[0])) {
                $ret = $rootline[0]['uid'];
            }
        } else {
            #################
            # Other root PID
            #################
            if (!isset($cache[$uid])) {
                $cache[$uid] = null;
                $rootline    = self::getRootLine($uid);

                if (!empty($rootline[0])) {
                    $cache[$uid] = $rootline[0]['uid'];
                }
            }

            $ret = $cache[$uid];
        }

        return $ret;
    }
public static function getRootPid ( $ uid = null ) { static $ cache = array ( ) ; $ ret = null ; if ( $ uid === null ) { ################# # Current root PID ################# $ rootline = self :: getRootLine ( ) ; if ( ! empty ( $ rootline [ 0 ] ) ) { $ ret = $ rootline [ 0 ] [ 'uid' ] ; } } else { ################# # Other root PID ################# if ( ! isset ( $ cache [ $ uid ] ) ) { $ cache [ $ uid ] = null ; $ rootline = self :: getRootLine ( $ uid ) ; if ( ! empty ( $ rootline [ 0 ] ) ) { $ cache [ $ uid ] = $ rootline [ 0 ] [ 'uid' ] ; } } $ ret = $ cache [ $ uid ] ; } return $ ret ; }
Get current root pid

@param   integer|null $uid Page UID

@return  integer
Get current root pid