markdown file retrival working, got rid of unnecessary configs

This commit is contained in:
Ro 2021-03-24 16:59:28 -07:00
parent e459366c46
commit 31d5e1192c
10 changed files with 566 additions and 225 deletions

View file

@ -1,70 +0,0 @@
{
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {}
},
"rules": {
"constructor-super": 2,
"for-direction": 2,
"getter-return": 2,
"no-case-declarations": 2,
"no-class-assign": 2,
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-console": 1,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-control-regex": 1,
"no-debugger": 2,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-func-assign": 2,
"no-global-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-mixed-spaces-and-tabs": 2,
"no-new-symbol": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-self-assign": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-undef": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unsafe-negation": 2,
"no-unused-labels": 2,
"no-unused-vars": 2,
"no-useless-escape": 1,
"require-yield": 2,
"use-isnan": 2,
"valid-typeof": 2,
"no-duplicate-imports": 2
},
"env": {
"node": true,
"browser": true,
"es6": true
},
"globals": {
"_": false,
"hljs": false,
"Sortable": false,
"Prism": false
}
}

View file

@ -1,7 +0,0 @@
.babelrc
README.md
*.pug
*.sass
*.json
*.php

View file

@ -1,16 +0,0 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": true,
"proseWrap": "preserve",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"useTabs": true,
"tabWidth": 4,
"printWidth": 100
}

View file

@ -0,0 +1,18 @@
<?php
include "brain/data/Book.inc.php";
class DashControl
{
public function getPages($section)
{
$book = new Book("content/pages");
switch ($section) {
case "pages":
break;
default:
return $book->getContents();
break;
}
}
}

67
brain/data/Book.inc.php Normal file
View file

@ -0,0 +1,67 @@
<?php
use Mni\FrontYAML\Parser;
class Book
{
public $files = [];
public function __construct($folder)
{
$this->read($folder);
}
public function read($folder)
{
$folders = glob("$folder/*", GLOB_ONLYDIR);
foreach ($folders as $folder) {
//$this->files[] = $folder . "/";
$this->read($folder);
}
$files = array_filter(glob("$folder/*md"), "is_file");
foreach ($files as $file) {
$this->files[] = $file;
}
}
public function getContents()
{
$parser = new Parser();
$contents = [];
foreach ($this->files as $file) {
$doc = $parser->parse(file_get_contents($file), false);
$meta = $doc->getYAML();
$page = [
"id" => $meta["id"],
"uuid" => $meta["uuid"],
"title" => $meta["title"],
"feature" => $meta["feature"],
"path" => $meta["path"],
"layout" => $meta["layout"],
"tags" => $meta["tags"],
"author" => $meta["author"],
"created" => $meta["created"],
"deleted" => $meta["deleted"],
"menu" => $meta["menu"],
"featured" => $meta["featured"],
"published" => $meta["published"],
"slug" => $meta["slug"],
"filePath" => $file,
"content" => $doc->getContent(),
];
//checks for duplicates
$uuid = $meta["uuid"];
$found = current(
array_filter($contents, function ($item) use ($uuid) {
return isset($item["uuid"]) && $uuid == $item["uuid"];
})
);
// if uuid is not present, add it
if (!$found) {
array_push($contents, $page);
}
}
return $contents;
}
}

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
</head>
<body>
There are
{{ totalPages }}
pages total, hoss.
<br/>
{% for page in pages %}
{# <a href="/blog/{{ page.slug }}">{{ page.title }}</a><br/><br/>
#}
{{ page["title"] }}
{{ page['filePath'] }}
<br/>
{% endfor %}
</body>
</html>

View file

@ -7,20 +7,6 @@
<title>{{ title }}</title>
</head>
<body>
<p>
{{ name }}
is a
{{ occupation }}
</p>
<br>
<div>
{{ folks }}
has
{{ secret }}
</div>
</body>
<body></body>
</html>

View file

@ -3,6 +3,7 @@
"slim/slim": "4.*",
"slim/psr7": "^1.2",
"twig/twig": "^3.0",
"slim/twig-view": "^3.0"
"slim/twig-view": "^3.0",
"mnapoli/front-yaml": "^1.8"
}
}

499
composer.lock generated
View file

@ -4,24 +4,74 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b442ae03c61541c3f8c578413aabe98e",
"content-hash": "7886761b471ff848a2dc078d8765be25",
"packages": [
{
"name": "fig/http-message-util",
"version": "1.1.4",
"name": "erusev/parsedown",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message-util.git",
"reference": "3242caa9da7221a304b8f84eb9eaddae0a7cf422"
"url": "https://github.com/erusev/parsedown.git",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message-util/zipball/3242caa9da7221a304b8f84eb9eaddae0a7cf422",
"reference": "3242caa9da7221a304b8f84eb9eaddae0a7cf422",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": ""
},
"require": {
"php": "^5.3 || ^7.0"
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"support": {
"issues": "https://github.com/erusev/parsedown/issues",
"source": "https://github.com/erusev/parsedown/tree/1.7.x"
},
"time": "2019-12-30T22:54:17+00:00"
},
{
"name": "fig/http-message-util",
"version": "1.1.5",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message-util.git",
"reference": "9d94dc0154230ac39e5bf89398b324a86f63f765"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765",
"reference": "9d94dc0154230ac39e5bf89398b324a86f63f765",
"shasum": ""
},
"require": {
"php": "^5.3 || ^7.0 || ^8.0"
},
"suggest": {
"psr/http-message": "The package containing the PSR-7 interfaces"
@ -44,7 +94,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Utility classes and constants for use with PSR-7 (psr/http-message)",
@ -58,9 +108,48 @@
],
"support": {
"issues": "https://github.com/php-fig/http-message-util/issues",
"source": "https://github.com/php-fig/http-message-util/tree/1.1.4"
"source": "https://github.com/php-fig/http-message-util/tree/1.1.5"
},
"time": "2020-02-05T20:36:27+00:00"
"time": "2020-11-24T22:02:12+00:00"
},
{
"name": "mnapoli/front-yaml",
"version": "1.8.0",
"source": {
"type": "git",
"url": "https://github.com/mnapoli/FrontYAML.git",
"reference": "76baa8ca538e111bfe53ac49c6a512ec5ea2bf54"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mnapoli/FrontYAML/zipball/76baa8ca538e111bfe53ac49c6a512ec5ea2bf54",
"reference": "76baa8ca538e111bfe53ac49c6a512ec5ea2bf54",
"shasum": ""
},
"require": {
"erusev/parsedown": "~1.0",
"php": ">=7.3",
"symfony/yaml": "~2.1|^3.0|^4.0|^5.0"
},
"require-dev": {
"league/commonmark": "~1.4",
"phpunit/phpunit": "^9.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Mni\\FrontYAML\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"support": {
"issues": "https://github.com/mnapoli/FrontYAML/issues",
"source": "https://github.com/mnapoli/FrontYAML/tree/1.8.0"
},
"time": "2020-12-04T10:52:19+00:00"
},
{
"name": "nikic/fast-route",
@ -114,27 +203,22 @@
},
{
"name": "psr/container",
"version": "1.0.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=7.2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
@ -147,7 +231,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
@ -161,9 +245,9 @@
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/master"
"source": "https://github.com/php-fig/container/tree/1.1.1"
},
"time": "2017-02-14T16:28:37+00:00"
"time": "2021-03-05T17:36:06+00:00"
},
{
"name": "psr/http-factory",
@ -483,24 +567,25 @@
},
{
"name": "slim/psr7",
"version": "1.2.0",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim-Psr7.git",
"reference": "832912cb3c2a807d472ef0ac392552e85703a667"
"reference": "235d2e5a5ee1ad4b97b96870f37f3091b22fffd7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/832912cb3c2a807d472ef0ac392552e85703a667",
"reference": "832912cb3c2a807d472ef0ac392552e85703a667",
"url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/235d2e5a5ee1ad4b97b96870f37f3091b22fffd7",
"reference": "235d2e5a5ee1ad4b97b96870f37f3091b22fffd7",
"shasum": ""
},
"require": {
"fig/http-message-util": "^1.1.4",
"php": "^7.2",
"php": "^7.2 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"ralouphie/getallheaders": "^3"
"ralouphie/getallheaders": "^3",
"symfony/polyfill-php80": "^1.18"
},
"provide": {
"psr/http-factory-implementation": "1.0",
@ -509,11 +594,12 @@
"require-dev": {
"adriansuter/php-autoload-override": "^1.2",
"ext-json": "*",
"http-interop/http-factory-tests": "^0.6.0",
"http-interop/http-factory-tests": "^0.7.0",
"php-http/psr7-integration-tests": "dev-master",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5"
"phpunit/phpunit": "^8.5 || ^9.3",
"squizlabs/php_codesniffer": "^3.5",
"weirdan/prophecy-shim": "^1.0 || ^2.0.2"
},
"type": "library",
"autoload": {
@ -556,28 +642,28 @@
],
"support": {
"issues": "https://github.com/slimphp/Slim-Psr7/issues",
"source": "https://github.com/slimphp/Slim-Psr7/tree/master"
"source": "https://github.com/slimphp/Slim-Psr7/tree/1.3.0"
},
"time": "2020-08-18T22:49:11+00:00"
"time": "2020-11-28T06:28:46+00:00"
},
{
"name": "slim/slim",
"version": "4.5.0",
"version": "4.7.1",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "5613cbb521081ed676d5d7eb3e44f2b80a818c24"
"reference": "0905e0775f8c1cfb3bbcfabeb6588dcfd8b82d3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/5613cbb521081ed676d5d7eb3e44f2b80a818c24",
"reference": "5613cbb521081ed676d5d7eb3e44f2b80a818c24",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/0905e0775f8c1cfb3bbcfabeb6588dcfd8b82d3f",
"reference": "0905e0775f8c1cfb3bbcfabeb6588dcfd8b82d3f",
"shasum": ""
},
"require": {
"ext-json": "*",
"nikic/fast-route": "^1.3",
"php": "^7.2",
"php": "^7.2 || ^8.0",
"psr/container": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
@ -586,19 +672,20 @@
"psr/log": "^1.1"
},
"require-dev": {
"adriansuter/php-autoload-override": "^1.0",
"adriansuter/php-autoload-override": "^1.2",
"ext-simplexml": "*",
"guzzlehttp/psr7": "^1.5",
"guzzlehttp/psr7": "^1.7",
"http-interop/http-factory-guzzle": "^1.0",
"laminas/laminas-diactoros": "^2.1",
"nyholm/psr7": "^1.1",
"nyholm/psr7-server": "^0.3.0",
"phpspec/prophecy": "^1.10",
"phpstan/phpstan": "^0.11.5",
"phpunit/phpunit": "^8.5",
"slim/http": "^1.0",
"slim/psr7": "^1.0",
"squizlabs/php_codesniffer": "^3.5"
"laminas/laminas-diactoros": "^2.4",
"nyholm/psr7": "^1.3",
"nyholm/psr7-server": "^1.0.1",
"phpspec/prophecy": "^1.12",
"phpstan/phpstan": "^0.12.58",
"phpunit/phpunit": "^8.5.13",
"slim/http": "^1.2",
"slim/psr7": "^1.3",
"squizlabs/php_codesniffer": "^3.5",
"weirdan/prophecy-shim": "^1.0 || ^2.0.2"
},
"suggest": {
"ext-simplexml": "Needed to support XML format in BodyParsingMiddleware",
@ -652,8 +739,14 @@
"router"
],
"support": {
"docs": "https://www.slimframework.com/docs/v4/",
"forum": "https://discourse.slimframework.com/",
"irc": "irc://irc.freenode.net:6667/slimphp",
"issues": "https://github.com/slimphp/Slim/issues",
"source": "https://github.com/slimphp/Slim/tree/4.x"
"rss": "https://www.slimframework.com/blog/feed.rss",
"slack": "https://slimphp.slack.com/",
"source": "https://github.com/slimphp/Slim",
"wiki": "https://github.com/slimphp/Slim/wiki"
},
"funding": [
{
@ -665,33 +758,34 @@
"type": "tidelift"
}
],
"time": "2020-04-14T20:49:48+00:00"
"time": "2020-12-01T19:41:22+00:00"
},
{
"name": "slim/twig-view",
"version": "3.1.0",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Twig-View.git",
"reference": "36f7a04ca9e58ef926dc25cd0110f629668cb3f0"
"reference": "9ceaff0764ab8e70f9eeee825a9efd0b4e1dfc85"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Twig-View/zipball/36f7a04ca9e58ef926dc25cd0110f629668cb3f0",
"reference": "36f7a04ca9e58ef926dc25cd0110f629668cb3f0",
"url": "https://api.github.com/repos/slimphp/Twig-View/zipball/9ceaff0764ab8e70f9eeee825a9efd0b4e1dfc85",
"reference": "9ceaff0764ab8e70f9eeee825a9efd0b4e1dfc85",
"shasum": ""
},
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"psr/http-message": "^1.0",
"slim/slim": "^4.0",
"twig/twig": "^3.0"
"slim/slim": "^4.7",
"twig/twig": "^3.1"
},
"require-dev": {
"phpstan/phpstan": "^0.11.15",
"phpunit/phpunit": "^8.5",
"phpstan/phpstan": "^0.12.58",
"phpunit/phpunit": "^8.5.13 || ^9.3.8",
"psr/http-factory": "^1.0",
"squizlabs/php_codesniffer": "^3.5"
"squizlabs/php_codesniffer": "^3.5",
"weirdan/prophecy-shim": "^1.0 || ^2.0.2"
},
"type": "library",
"autoload": {
@ -726,22 +820,89 @@
],
"support": {
"issues": "https://github.com/slimphp/Twig-View/issues",
"source": "https://github.com/slimphp/Twig-View/tree/3.x"
"source": "https://github.com/slimphp/Twig-View/tree/3.2.0"
},
"time": "2020-03-13T18:08:36+00:00"
"time": "2020-12-08T17:04:14+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.20.0",
"name": "symfony/deprecation-contracts",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41"
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41",
"reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665",
"reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/master"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-09-07T11:33:47+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.22.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
"reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
"shasum": ""
},
"require": {
@ -753,7 +914,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.20-dev"
"dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -791,7 +952,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1"
},
"funding": [
{
@ -807,20 +968,20 @@
"type": "tidelift"
}
],
"time": "2020-10-23T14:02:19+00:00"
"time": "2021-01-07T16:49:33+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.20.0",
"version": "v1.22.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "39d483bdf39be819deabf04ec872eb0b2410b531"
"reference": "5232de97ee3b75b0360528dae24e73db49566ab1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531",
"reference": "39d483bdf39be819deabf04ec872eb0b2410b531",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1",
"reference": "5232de97ee3b75b0360528dae24e73db49566ab1",
"shasum": ""
},
"require": {
@ -832,7 +993,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.20-dev"
"dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -871,7 +1032,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1"
},
"funding": [
{
@ -887,20 +1048,178 @@
"type": "tidelift"
}
],
"time": "2020-10-23T14:02:19+00:00"
"time": "2021-01-22T09:19:47+00:00"
},
{
"name": "twig/twig",
"version": "v3.1.1",
"name": "symfony/polyfill-php80",
"version": "v1.22.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "b02fa41f3783a2616eccef7b92fbc2343ffed737"
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/b02fa41f3783a2616eccef7b92fbc2343ffed737",
"reference": "b02fa41f3783a2616eccef7b92fbc2343ffed737",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91",
"reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.22-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-01-07T16:49:33+00:00"
},
{
"name": "symfony/yaml",
"version": "v5.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "298a08ddda623485208506fcee08817807a251dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/298a08ddda623485208506fcee08817807a251dd",
"reference": "298a08ddda623485208506fcee08817807a251dd",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"symfony/console": "<4.4"
},
"require-dev": {
"symfony/console": "^4.4|^5.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"bin": [
"Resources/bin/yaml-lint"
],
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v5.2.5"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-03-06T07:59:01+00:00"
},
{
"name": "twig/twig",
"version": "v3.3.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5",
"reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5",
"shasum": ""
},
"require": {
@ -915,7 +1234,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -951,7 +1270,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.1.1"
"source": "https://github.com/twigphp/Twig/tree/v3.3.0"
},
"funding": [
{
@ -963,7 +1282,7 @@
"type": "tidelift"
}
],
"time": "2020-10-27T19:28:23+00:00"
"time": "2021-02-08T09:54:36+00:00"
}
],
"packages-dev": [],

View file

@ -5,35 +5,53 @@ use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
include 'brain/controller/IndexControl.inc.php';
include 'brain/data/Settings.inc.php';
include "brain/controller/IndexControl.inc.php";
include "brain/controller/DashControl.inc.php";
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . "/vendor/autoload.php";
$app = AppFactory::create();
$twig = Twig::create('brain/views/default/');
$twig = Twig::create("brain/views/default/");
$app->add(TwigMiddleware::create($app, $twig));
//Index
$app->get('/[{first}[/{second}]]', function (Request $request, Response $response, array $args) {
if(isset($args['first']))
{
$first = $args['first'];
if(is_numeric($first))
{
$app->get("/[{first}[/{second}]]", function (
Request $request,
Response $response,
array $args
) {
$view = Twig::fromRequest($request);
if (isset($args["first"])) {
$first = $args["first"];
if (is_numeric($first)) {
$response->getBody()->write("FIND A PAGE, B!");
} else {
$response->getBody()->write("This is the dash, brah!");
};
//$response->getBody()->write("This is the dash, brah!");
if (isset($args["second"])) {
$section = $args["second"];
} else {
$section = "front";
}
$dash = new DashControl();
$pages = $dash->getPages($section);
$count = count($pages);
//$response->getBody()->write("There are ".$count." pages, champ");
return $view->render($response, "dash-index.twig", [
"title" => "Fipamo Dash",
"pages" => $pages,
"totalPages" => $count,
]);
}
} else {
$response->getBody()->write("No Params, Homie!");
}
if(isset($args['second']))
{
$year = $args['second'];
};
if (isset($args["second"])) {
$year = $args["second"];
}
return $response;
});