Get user-visible "Path" for this record

@param File $record
@param array $context
@return string
516251
protected function getPath($record, $context = [])
    {
        if ($record && $record->isInDB()) {
            if ($record->ParentID) {
                return $record->Parent()->getFilename();
            } else {
                return '/';
            }
        }
        if (isset($context['ParentID'])) {
            if ($context['ParentID'] === 0) {
                return '/';
            }
            /** @var File $file */
            $file = File::get()->byID($context['ParentID']);
            if ($file) {
                return $file->getFilename();
            }
        }
        return null;
    }
269430
function reachin( path, record ) {
	var context = record;
	var part;
	var _i;
	var _len;

	for ( _i = 0, _len = path.length; _i < _len; _i++ ) {
		part = path[_i];
		context = context[part];
		if ( sys.isNull( context ) || sys.isUndefined( context ) ) {
			break;
		}
	}

	return context;
}
1145518
protected function canEditState($record)
	{
		$user = JFactory::getUser();

		// Check for existing category.
		if (!empty($record->id))
		{
			return $user->authorise('core.edit.state', $record->extension . '.category.' . (int) $record->id);
		}

		// New category, so check against the parent.
		if (!empty($record->parent_id))
		{
			return $user->authorise('core.edit.state', $record->extension . '.category.' . (int) $record->parent_id);
		}

		// Default to component settings if neither category nor parent known.
		return $user->authorise('core.edit.state', $record->extension);
	}
1193760
private function getImagePath(FileStorage $entity, string $version) : string
    {
        $hash = (string)Configure::read(sprintf('FileStorage.imageHashes.file_storage.%s', $version));
        if (empty($hash)) {
            return $entity->get('path');
        }

        $event = new Event('ImageVersion.getVersions', $this, [
            'hash' => $hash,
            'image' => $entity,
            'version' => $version,
            'options' => [],
            'pathType' => 'fullPath'
        ]);

        EventManager::instance()->dispatch($event);

        if (! $event->getResult()) {
            return $entity->get('path');
        }

        return file_exists(WWW_ROOT . trim($event->getResult(), DS)) ?
            $event->getResult() :
            $entity->get('path');
    }
1163193
public function getPath(Version $file_version, ThumbnailVersion $thumbnail)
    {
        /** @var File $file */
        $file = $file_version->getFile();
        $format = $this->formatService->getFormatForFile($file_version);
        $file_id = $file->getFileID();
        $storage_location = $file->getFileStorageLocationObject();
        $configuration = $storage_location->getConfigurationObject();
        $version_id = $file_version->getFileVersionID();
        $storage_location_id = $storage_location->getID();
        $thumbnail_handle = $thumbnail->getHandle();
        $defer = $configuration instanceof DeferredConfigurationInterface;

        // Get the path from the storage
        $path = $this->getStoredThumbnailPath(
            $file_id,
            $version_id,
            $storage_location_id,
            $thumbnail_handle,
            $format
        );

        // If we don't have a stored path already, lets determine one and store it
        if (!$path) {
            $path = $this->determineThumbnailPath($file_version, $thumbnail, $storage_location, $configuration, $format);
            if ($path) {
                $this->storeThumbnailPath($path, $file_id, $version_id, $storage_location_id, $thumbnail_handle, $format, !$defer);
            }
        }

        // Pass the path to the "getBuiltThumbnailPath" method which will alter the path if it wants to
        $realPath = $this->getBuiltThumbnailPath($path, $file_version, $thumbnail, $storage_location, $configuration, $format);

        // If the "getBuiltThumbnailPath" method didn't alter the path, lLet's let the configuration resolve the path now
        if ($path == $realPath && $defer) {
            try {
                $realPath = $this->getPathFromConfiguration($realPath, $configuration);
            } catch (\InvalidArgumentException $e) {
                // Unable to resolve the path from the configuration object, lets return the real path
            }
        }

        return $realPath;
    }
65596
public static function rpath(String $file = NULL) : String
    {
        $config = Config::get('Filesystem', 'file', self::$access);

        self::$access = NULL;

        if( $config['parentDirectoryAccess'] === false )
        {
            $file = str_replace('../', '', $file);
        }

        if( $config['realPath'] === true )
        {
            $file = Base::prefix(self::originpath($file), REAL_BASE_DIR);
        }

        return $file;
    }
1317800
protected function getValueFromContext($rule, $context)
    {
        $segments = explode('.', $rule->field);
        foreach ($segments as $segment) {
            if (!isset($context[$segment])) {
                $context = false;
                break;
            }
            $context = $context[$segment];
        }

        return $context;
    }
786483
private function processRouteMatchLogRecord(array $record)
    {
        if ($this->isAsseticLog($record)) {
            $record['message'] = '{method}: {request_uri}';

            return $record;
        }

        $context = $record['context'];

        unset($context['method']);
        unset($context['request_uri']);

        $record['context'] = array_merge(
            array($record['context']['method'] => $record['context']['request_uri']),
            $context
        );

        return $record;
    }
1184661
public static function path( $file = null, $key = null ) 
	{
		// get the storage key
		if ( is_null( $key ) ) 
		{
			$key = static::$default;
		}

		// check if path exists
		if ( !isset( static::$paths[$key] ) ) 
		{
			throw new CCException( 'CCStorage - use of undefined storage path '.$key.'.' );
		}
			
		if ( strpos( $file, ':' ) )
		{
			$file = static::file( $file );
		}
		
		return static::$paths[$key].$file;
	}
429042
public function format(array $record): string
    {
        $normalized = $this->normalize($record);
        if (isset($normalized['context']) && $normalized['context'] === []) {
            $normalized['context'] = new \stdClass;
        }
        if (isset($normalized['extra']) && $normalized['extra'] === []) {
            $normalized['extra'] = new \stdClass;
        }

        return $this->toJson($normalized, true) . ($this->appendNewline ? "\n" : '');
    }
1314689
protected function _getUrl($entity, $field)
    {
        $path = '/' . $this->_getPath($entity, $field, ['root' => false, 'file' => true]);
        return str_replace(DS, '/', $path);
    }
712626
protected function moveFile( $context, $path )
	{
		$filename = basename( $path );
		$context->getFileSystemManager()->get( 'fs-admin' )->writef( $filename, $path );

		unlink( $path );
		return $filename;
	}
619743
protected function getFormFieldSecurityTab($record, $context = [])
    {
        // Get permissions
        $viewersOptionsField = [
            'Inherit' => _t(__CLASS__.'.INHERIT', 'Inherit from parent folder'),
            'Anyone' => _t(__CLASS__.'.ANYONE', 'Anyone'),
            'LoggedInUsers' => _t(__CLASS__.'.LOGGED_IN', 'Logged-in users'),
            'OnlyTheseUsers' => _t(__CLASS__.'.ONLY_GROUPS', 'Only these groups (choose from list)')
        ];

        // No "Anyone" editors option
        $editorsOptionsField = $viewersOptionsField;
        unset($editorsOptionsField['Anyone']);

        return Tab::create(
            'Permissions',
            OptionsetField::create(
                'CanViewType',
                _t(__CLASS__.'.ACCESSHEADER', 'Who can view this file?')
            )
                ->setSource($viewersOptionsField),
            TreeMultiselectField::create(
                'ViewerGroups',
                _t(__CLASS__.'.VIEWERGROUPS', 'Viewer Groups')
            ),
            OptionsetField::create(
                "CanEditType",
                _t(__CLASS__.'.EDITHEADER', 'Who can edit this file?')
            )
                ->setSource($editorsOptionsField),
            TreeMultiselectField::create(
                'EditorGroups',
                _t(__CLASS__.'.EDITORGROUPS', 'Editor Groups')
            )
        );
    }
63356
public function processRecord(array $record)
    {
        if (is_null($this->user)) {
            /* @var TokenStorageInterface $securityTokenStorage */
            $securityTokenStorage = $this->container->get('security.token_storage');
            if (($securityTokenStorage !== null) && ($securityTokenStorage->getToken() !== null) && ($securityTokenStorage->getToken()->getUser() instanceof \Symfony\Component\Security\Core\User\AdvancedUserInterface)) {
                $this->user = $securityTokenStorage->getToken()->getUser();
                $this->record['extra']['user']['username'] = $this->user->getUsername();
                $this->record['extra']['user']['roles'] = $this->user->getRoles();
                $this->record['extra']['user']['is_account_non_expired'] = $this->user->isAccountNonExpired();
                $this->record['extra']['user']['is_account_non_locked'] = $this->user->isAccountNonLocked();
                $this->record['extra']['user']['is_credentials_non_expired'] = $this->user->isCredentialsNonExpired();
                $this->record['extra']['user']['is_enabled'] = $this->user->isEnabled();
            }
        }

        return array_merge($record, $this->record);
    }
921809
public function get_document($record, $options = array()) {
        try {
            $cm = $this->get_cm('book', $record->bookid, $record->courseid);
            $context = \context_module::instance($cm->id);
        } catch (\dml_missing_record_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' .
                $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        } catch (\dml_exception $ex) {
            // Notify it as we run here as admin, we should see everything.
            debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), DEBUG_DEVELOPER);
            return false;
        }

        // Prepare associative array with data from DB.
        $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
        $doc->set('title', content_to_text($record->title, false));
        $doc->set('content', content_to_text($record->content, $record->contentformat));
        $doc->set('contextid', $context->id);
        $doc->set('courseid', $record->courseid);
        $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID);
        $doc->set('modified', $record->timemodified);

        // Check if this document should be considered new.
        if (isset($options['lastindexedtime']) && ($options['lastindexedtime'] < $record->timecreated)) {
            // If the document was created after the last index time, it must be new.
            $doc->set_is_new(true);
        }

        return $doc;
    }
1106564
public function getRecordUrl($record)
    {
        if (isset($this->recordOnClick)) {
            return 'javascript:;';
        }

        if (!isset($this->recordUrl)) {
            return null;
        }

        $url = RouterHelper::replaceParameters($record, $this->recordUrl);
        return Backend::url($url);
    }
23572
protected function getSpecsMarkup($record)
    {
        if (!$record || !$record->exists()) {
            return null;
        }
        return sprintf(
            '<div class="editor__specs">%s %s</div>',
            $record->getSize(),
            $this->getStatusFlagMarkup($record)
        );
    }