Skip to content

Commit

Permalink
Alpha-release
Browse files Browse the repository at this point in the history
  • Loading branch information
OleVik committed Nov 7, 2018
0 parents commit 86a2369
Show file tree
Hide file tree
Showing 101 changed files with 11,623 additions and 0 deletions.
200 changes: 200 additions & 0 deletions .gitignore
@@ -0,0 +1,200 @@
# Created by https://www.gitignore.io/api/node,sass,composer,phpstorm,macos,linux,windows

### Composer ###
composer.phar

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Sass ###
.sass-cache/
*.css.map


### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk
103 changes: 103 additions & 0 deletions API/Push.php
@@ -0,0 +1,103 @@
<?php
/**
* @package Storage
*
* @license MIT License
*/

namespace Grav\Plugin\PresentationPlugin\API;

/**
* Simple REST API for communicating commands between pages
*
* @package Grav\Plugins
*/
class Push
{
/**
* Initiate Push Storage
*
* @param string $directory Path to directory.
* @param string $file Filename.
*/
public function __construct($directory, $file)
{
$this->directory = $directory;
$this->file = $file;
$this->DS = DIRECTORY_SEPARATOR;
}

/**
* Set Push Command
*
* @param string $command Command to execute.
*
* @throws Exception Errors from file operations.
*
* @return bool State of execution.
*/
public function set($command)
{
try {
if (!is_writable($this->directory)) {
try {
mkdir($this->directory, 0755, true);
} catch(\Exception $e) {
throw new \Exception($e);
}
}
try {
$data = json_encode($command);
file_put_contents($this->directory . $this->DS . $this->file, $data);
echo $data;
return true;
} catch(\Exception $e) {
throw new \Exception($e);
}
return false;
} catch(\Exception $e) {
throw new \Exception($e);
}
}

/**
* Get Push Command
*
* @throws Exception Errors from file operations.
*
* @return bool Command to execute.
*/
public function get()
{
try {
$target = $this->directory . $this->DS . $this->file;
if (file_exists($target)) {
$data = file_get_contents($target);
echo $data;
return true;
}
} catch(\Exception $e) {
throw new \Exception($e);
}
}

/**
* Remove Push Command
*
* @throws Exception Errors from file operations.
*
* @return bool State of execution.
*/
public function remove()
{
try {
$target = $this->directory . $this->DS . $this->file;
unlink($target);
echo 'removed ' . $this->file;
return true;
} catch(\Exception $e) {
throw new \Exception($e);
}
return false;
}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,5 @@
# v0.0.1
## 07-11-2018

1. [](#new)
* Alpha public release
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Ole Vik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 86a2369

Please sign in to comment.