Initial commit
This commit is contained in:
commit
c62209a330
16 changed files with 459 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/vendor
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"php-docblocker.author": {
|
||||||
|
"name": "Jay Trees",
|
||||||
|
"email": "github.jay@grandel.anonaddy.me"
|
||||||
|
},
|
||||||
|
}
|
14
README.md
Normal file
14
README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# wishthis
|
||||||
|
|
||||||
|
A simple wishlist plattform.
|
||||||
|
|
||||||
|
This project is a work in progress and not ready for production use.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
* PHP 8
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Install dependencies
|
||||||
|
```
|
||||||
|
composer install
|
||||||
|
```
|
5
composer.json
Normal file
5
composer.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
|
||||||
|
}
|
||||||
|
}
|
145
composer.lock
generated
Normal file
145
composer.lock
generated
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "7be6c4a10877152fb055dc27901cb0a6",
|
||||||
|
"packages": [],
|
||||||
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||||
|
"version": "v0.7.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
|
||||||
|
"reference": "fe390591e0241955f22eb9ba327d137e501c771c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c",
|
||||||
|
"reference": "fe390591e0241955f22eb9ba327d137e501c771c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^1.0 || ^2.0",
|
||||||
|
"php": ">=5.3",
|
||||||
|
"squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"composer/composer": "*",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.0",
|
||||||
|
"sensiolabs/security-checker": "^4.1.0"
|
||||||
|
},
|
||||||
|
"type": "composer-plugin",
|
||||||
|
"extra": {
|
||||||
|
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Franck Nijhof",
|
||||||
|
"email": "franck.nijhof@dealerdirect.com",
|
||||||
|
"homepage": "http://www.frenck.nl",
|
||||||
|
"role": "Developer / IT Manager"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
|
||||||
|
"homepage": "http://www.dealerdirect.com",
|
||||||
|
"keywords": [
|
||||||
|
"PHPCodeSniffer",
|
||||||
|
"PHP_CodeSniffer",
|
||||||
|
"code quality",
|
||||||
|
"codesniffer",
|
||||||
|
"composer",
|
||||||
|
"installer",
|
||||||
|
"phpcs",
|
||||||
|
"plugin",
|
||||||
|
"qa",
|
||||||
|
"quality",
|
||||||
|
"standard",
|
||||||
|
"standards",
|
||||||
|
"style guide",
|
||||||
|
"stylecheck",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
|
||||||
|
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
|
||||||
|
},
|
||||||
|
"time": "2020-12-07T18:04:37+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "squizlabs/php_codesniffer",
|
||||||
|
"version": "3.6.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||||
|
"reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e",
|
||||||
|
"reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"ext-tokenizer": "*",
|
||||||
|
"ext-xmlwriter": "*",
|
||||||
|
"php": ">=5.4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/phpcs",
|
||||||
|
"bin/phpcbf"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Greg Sherwood",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
||||||
|
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||||
|
"keywords": [
|
||||||
|
"phpcs",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
||||||
|
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||||
|
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
||||||
|
},
|
||||||
|
"time": "2021-10-11T04:00:11+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": [],
|
||||||
|
"plugin-api-version": "2.1.0"
|
||||||
|
}
|
52
includes/assets/css/default.css
Normal file
52
includes/assets/css/default.css
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
:root {
|
||||||
|
--color-primary: blue;
|
||||||
|
|
||||||
|
--radius-default: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 14pt;
|
||||||
|
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buttons
|
||||||
|
*/
|
||||||
|
button,
|
||||||
|
.button,
|
||||||
|
input[type="submit"],
|
||||||
|
input[type="button"] {
|
||||||
|
padding: 0.4em 1.6em;
|
||||||
|
|
||||||
|
font-size: inherit;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
border: none;
|
||||||
|
border-radius: var(--radius-default);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.primary,
|
||||||
|
input[type="submit"] {
|
||||||
|
color: #fff;
|
||||||
|
background-color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
11
includes/assets/css/install.css
Normal file
11
includes/assets/css/install.css
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
main {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
max-width: 768px;
|
||||||
|
}
|
67
includes/classes/page.php
Normal file
67
includes/classes/page.php
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* page.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wishthis;
|
||||||
|
|
||||||
|
class Page
|
||||||
|
{
|
||||||
|
private string $language = 'en';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __construct
|
||||||
|
*
|
||||||
|
* @param string $filepath The filepath (__FILE__) of the page.
|
||||||
|
* @param string $title The HTML title of the page.
|
||||||
|
*/
|
||||||
|
public function __construct(string $filepath, public string $title = 'wishthis')
|
||||||
|
{
|
||||||
|
$this->name = pathinfo($filepath, PATHINFO_FILENAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function header(): void
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<?= $this->language ?>">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Stylesheets
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Default */
|
||||||
|
$stylesheetDefault = 'includes/assets/css/default.css';
|
||||||
|
$stylesheetDefaultModified = filemtime($stylesheetDefault);
|
||||||
|
echo '<link rel="stylesheet" href="' . $stylesheetDefault . '?m=' . $stylesheetDefaultModified . '" />';
|
||||||
|
|
||||||
|
/** Page */
|
||||||
|
$stylesheetPage = 'includes/assets/css/' . $this->name . '.css';
|
||||||
|
|
||||||
|
if (file_exists($stylesheetPage)) {
|
||||||
|
$stylesheetPageModified = filemtime($stylesheetPage);
|
||||||
|
|
||||||
|
echo '<link rel="stylesheet" href="' . $stylesheetPage . '?m=' . $stylesheetPageModified . '" />';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<title><?= $this->title ?></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
public function footer(): void
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
7
includes/config/config-sample.php
Normal file
7
includes/config/config-sample.php
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* config-sample.php
|
||||||
|
*
|
||||||
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
|
*/
|
7
includes/config/config.php
Normal file
7
includes/config/config.php
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* config-sample.php
|
||||||
|
*
|
||||||
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
|
*/
|
23
includes/functions/auto-include.php
Normal file
23
includes/functions/auto-include.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* auto-include.php
|
||||||
|
*
|
||||||
|
* Includes all *.php files in a given directory (including sub directories).
|
||||||
|
*
|
||||||
|
* @param string $directoryToInclude The absolute directory to include.
|
||||||
|
*
|
||||||
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
function autoInclude(string $directoryToInclude)
|
||||||
|
{
|
||||||
|
foreach (scandir($directoryToInclude) as $filename) {
|
||||||
|
$filepath = str_replace('\\', '/', $directoryToInclude . '/' . $filename);
|
||||||
|
$filepathThis = str_replace('\\', '/', __FILE__);
|
||||||
|
|
||||||
|
if (is_file($filepath) && $filepathThis !== $filepath) {
|
||||||
|
require $filepath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
includes/pages/home.php
Normal file
19
includes/pages/home.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* home.php
|
||||||
|
*
|
||||||
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
use wishthis\Page;
|
||||||
|
|
||||||
|
$page = new page(__FILE__, 'Home');
|
||||||
|
$page->header();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Hello</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$page->footer();
|
||||||
|
?>
|
51
includes/pages/install.php
Normal file
51
includes/pages/install.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* index.php
|
||||||
|
*
|
||||||
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
use wishthis\Page;
|
||||||
|
|
||||||
|
$page = new page(__FILE__, 'Home');
|
||||||
|
$page->header();
|
||||||
|
|
||||||
|
if (isset($_POST['action']) && 'install' === $_POST['action']) {
|
||||||
|
$configDirectory = 'includes/config';
|
||||||
|
$configPath = $configDirectory . '/config.php';
|
||||||
|
$configSamplePath = $configDirectory . '/config-sample.php';
|
||||||
|
$configContents = file_get_contents($configSamplePath);
|
||||||
|
|
||||||
|
file_put_contents($configPath, $configContents);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<h1>Success</h1>
|
||||||
|
<p>wishthis has been successfully installed.</p>
|
||||||
|
|
||||||
|
<a class="button primary" href="">Continue</a>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<h1>Install</h1>
|
||||||
|
<p>Welcome to the wishthis installer.</p>
|
||||||
|
|
||||||
|
<p>Click Install to begin the installation.</p>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="action" value="install" />
|
||||||
|
|
||||||
|
<input type="submit" value="Install" />
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
$page->footer();
|
36
index.php
Normal file
36
index.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* index.php
|
||||||
|
*
|
||||||
|
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include
|
||||||
|
*/
|
||||||
|
require 'includes/functions/auto-include.php';
|
||||||
|
|
||||||
|
autoInclude(__DIR__ . '/includes/classes');
|
||||||
|
autoInclude(__DIR__ . '/includes/functions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install
|
||||||
|
*/
|
||||||
|
$configPath = 'includes/config/config.php';
|
||||||
|
|
||||||
|
if (!file_exists($configPath)) {
|
||||||
|
$page = 'install';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page
|
||||||
|
*/
|
||||||
|
if (!isset($page)) {
|
||||||
|
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
|
||||||
|
}
|
||||||
|
$pagePath = 'includes/pages/' . $page . '.php';
|
||||||
|
|
||||||
|
if (file_exists($pagePath)) {
|
||||||
|
require $pagePath;
|
||||||
|
}
|
13
wishthis.code-workspace
Normal file
13
wishthis.code-workspace
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"php-docblocker.author": {
|
||||||
|
"name": "Jay Trees",
|
||||||
|
"email": "github.jay@grandel.anonaddy.me"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue