Generate an index for meta files.

@return array as meta index.
504350
private function createMeta()
    {
        $basepath = $this->config["basepath"];
        $filter   = $this->config["textfilter-frontmatter"];
        $pattern  = $this->config["meta"];
        $path     = "$basepath/$pattern";
        $textfilter = $this->di->get("textFilter");

        $index = [];
        foreach (glob_recursive($path) as $file) {
            // The key entry to index
            $key = dirname(substr($file, strlen($basepath) + 1));

            // Get info from base document
            $src = file_get_contents($file);
            $filtered = $textfilter->parse($src, $filter);
            $index[$key] = $filtered->frontmatter;

            // Add Toc to the data array
            $index[$key]["__toc__"] = $this->createBaseRouteToc($key);
        }

        // Add author details
        $this->meta = $index;
        $this->createAuthor();
        $this->createCategory();

        return $this->meta;
    }
679709
public function getSortableMetaKeys()
    {
        if (!isset($_POST['posttype']) || empty($_POST['posttype'])) {
            echo '0';
            die();
        }

        $meta = \Modularity\Helper\Post::getPosttypeMetaKeys($_POST['posttype']);

        $response = array(
            'meta_keys' => $meta,
            'sort_curr' => get_field('posts_sort_by', $_POST['post']),
            'filter_curr' => get_field('posts_meta_key', $_POST['post']),
        );

        echo json_encode($response);
        die();
    }
347366
public static function getMeta(): array
    {
        $self = static::getInstance();
        if (empty($self->meta)) {
            $cacheKey = "db.table.{$self->name}";
            $meta = Cache::get($cacheKey);
            if (!$meta) {
                $schema = DbProxy::getOption('connect', 'name');

                $meta = DbProxy::fetchUniqueGroup(
                    '
                    SELECT 
                      COLUMN_NAME AS `name`,
                      DATA_TYPE AS `type`,
                      COLUMN_DEFAULT AS `default`,
                      COLUMN_KEY AS `key`
                    FROM INFORMATION_SCHEMA.COLUMNS
                    WHERE TABLE_SCHEMA = ?
                      AND TABLE_NAME = ?',
                    [$schema, $self->getName()]
                );
                Cache::set($cacheKey, $meta, Cache::TTL_NO_EXPIRY, ['system', 'db']);
            }
            $self->meta = $meta;
        }
        return $self->meta;
    }
693737
private function getLocalizedMeta()
    {
        if ($this->localizedMeta) {
            return $this->localizedMeta;
        }

        $metas = $this->getFileVersion()->getMeta();
        $this->localizedMeta = $metas[0];

        foreach ($metas as $key => $meta) {
            if ($meta->getLocale() == $this->locale) {
                $this->localizedMeta = $meta;
                break;
            }
        }

        return $this->localizedMeta;
    }
365420
public function meta()
    {
        $meta = [];

        // look for basic parameters of transactions, only unconfirmed
        // transactions will have those fields empty.

        if (isset($this->attributes["id"]))
            $meta["id"] = (int) $this->attributes["id"];

        if (isset($this->attributes["height"]))
            $meta["height"] = (int) $this->attributes["height"];

        if (isset($this->attributes["hash"]))
            $meta["hash"] = ["data" => $this->attributes["hash"]];

        return $meta;
    }
1252843
protected function getIndexes()
    {
        $indexes = [];
        $rawIndexes = $this->getRawIndexes();

        foreach ($rawIndexes as $rawIndex) {
            $index = new Index($rawIndex->name);
            $index->addColumns(explode('|||', $rawIndex->columns));

            $indexes[] = $index;
        }

        return $indexes;
    }
603648
protected function linksToArray(): array
    {
        $links = [];

        foreach ($this->links as $name => $link)
        {
            if (! $link->hasMetadata()) {
                $links[$name] = $link->getReference();
                continue;
            }

            $links[$name] = [
                'href' => $link->getReference(),
                'meta' => $link->getMetadata()
            ];
        }

        return $links;
    }
1312362
def view_meta_index():
    
    rst_files = [filename[2:-4] for filename in sorted(glob.glob("./*.rst"))]
    rst_files.reverse()
    return template('index',
                    type="view",
                    filelist=rst_files,
                    name="__index__",
                    extended_name=None,
                    history=[],
                    gitref=None,
                    is_repo=check_repo())
231313
public function toArray(): array
    {
        $data = [
            'version' => $this->getVersion()
        ];

        if ($this->hasMetadata()) {
            $data['meta'] = $this->getMetadata();
        }

        return $data;
    }
174102
protected function buildIndex(): array
    {
        $file = $this->getFile($this->getStoragePath());
        $modified = $file->modified();

        $this->data = (array) $file->content();

        $list = [];
        foreach ($this->data as $key => $info) {
            $list[$key] = [
                'storage_key' => $key,
                'storage_timestamp' => $modified
            ];
        }

        return $list;
    }
209992
public function getFileList()
	{
		$list	= array();
		foreach( $this->files as $file )
			$list[$file['name']]	= $file['size'];
		return $list;
	}
1189125
public function getIndex(): Index
    {
        $index = $this->searchClient->findIndex($this->getIndexName());
        $index->setSettingsKey($this->searchClient->getIndexName());

        return $index;
    }
1322132
public function listContent()
    {
        $filesList = array();
        $numFiles = $this->archive->numFiles;
        for ($i = 0; $i < $numFiles; $i++) {
            $statIndex = $this->archive->statIndex($i);
            $filesList[] = (object) array(
                'filename' => $statIndex['name'],
                'stored_filename' => $statIndex['name'],
                'size' => $statIndex['size'],
                'compressed_size' => $statIndex['comp_size'],
                'mtime' => $statIndex,
                'comment' => ($comment = $this->archive->getCommentIndex
                    ($statIndex['index']) !== false) ? $comment : null,
                'folder' => in_array(substr($statIndex['name'], -1),
                    array('/', '\\')),
                'index' => $statIndex['index'],
                'status' => 'ok',
            );
        }

        return $filesList;
    }
993871
public function get_index()
    {
        if (!$this->indexes) {
            $this->indexes = array();
            if ($json = $this->get_cache('index')) {
                $this->indexes = json_decode($json, true);
            }
        }

        return $this->indexes;
    }
1140756
public function getMetadataPath()
    {
        $sModulePath = $this->getModuleFullPath();
        if (substr($sModulePath, -1) != DIRECTORY_SEPARATOR) {
            $sModulePath .= DIRECTORY_SEPARATOR;
        }

        return $sModulePath . 'metadata.php';
    }
44408
protected function createMetaInfoFolderAndFile()
    {
        $this->metaInfFolder = $this->createFolder($this->rootFolder, self::META_INF_FOLDER_NAME);

        $this->createManifestFile();

        return $this;
    }
823107
final public function get_meta() {
        global $CFG, $OUTPUT;
        $meta = new stdClass();
        $meta->id   = $this->id;
        $meta->name = format_string($this->get_name());
        $meta->type = $this->get_typename();
        $meta->icon = $OUTPUT->image_url('icon', 'repository_'.$meta->type)->out(false);
        $meta->supported_types = file_get_typegroup('extension', $this->supported_filetypes());
        $meta->return_types = $this->supported_returntypes();
        $meta->defaultreturntype = $this->default_returntype();
        $meta->sortorder = $this->options['sortorder'];
        return $meta;
    }