Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSmartSolutions committed May 6, 2019
0 parents commit 22acc98
Show file tree
Hide file tree
Showing 10 changed files with 429 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# CakePHP 3

/vendor/*
/config/app.php

/tmp/cache/models/*
!/tmp/cache/models/empty
/tmp/cache/persistent/*
!/tmp/cache/persistent/empty
/tmp/cache/views/*
!/tmp/cache/views/empty
/tmp/sessions/*
!/tmp/sessions/empty
/tmp/tests/*
!/tmp/tests/empty

/logs/*
!/logs/empty

# SonarQube

/.scannerwork/*


# PHPStorm

/.idea/*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Smart Solutions S.r.l.

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.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# cakephp-manifest
[![LICENSE](https://img.shields.io/github/license/smartsolutionsitaly/cakephp-manifest.svg)](LICENSE)
[![packagist](https://img.shields.io/badge/packagist-smartsolutionsitaly%2Fcakephp--manifest-brightgreen.svg)](https://packagist.org/packages/smartsolutionsitaly/cakephp-manifest)
[![issues](https://img.shields.io/github/issues/smartsolutionsitaly/cakephp-manifest.svg)](https://github.com/smartsolutionsitaly/cakephp-manifest/issues)
[![CakePHP](https://img.shields.io/badge/CakePHP-3.6%2B-brightgreen.svg)](https://github.com/cakephp/cakephp)

Manifest support for [CakePHP](https://github.com/cakephp/cakephp)

## Installation

You can install _cakephp-manifest_ into your project using [Composer](https://getcomposer.org).

``` bash
composer require smartsolutionsitaly/cakephp-manifest
```

## Setup

You can load this plugin running following command in terminal:

``` bash
bin/cake plugin load SmartSolutionsItaly\CakePHP\Manifest -r
```

or editing your _config/bootstrap.php_ adding this line at the end of the file:

```php
Plugin::load('SmartSolutionsItaly\CakePHP\Manifest', ['routes' => true]);
```

## License
Licensed under The MIT License
For full copyright and license information, please see the [LICENSE](LICENSE)
Redistributions of files must retain the above copyright notice.

## Copyright
Copyright (c) 2019 Smart Solutions S.r.l. (https://smartsolutions.it)
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name" : "smartsolutionsitaly/cakephp-manifest",
"description" : "Manifest support for CakePHP",
"keywords" : [
"cakephp",
"controller",
"manifest"
],
"type" : "cakephp-plugin",
"license" : "MIT",
"require-dev" : {
"php" : ">=7.0",
"cakephp/cakephp" : "^3.6",
"smartsolutionsitaly/cakephp-marketplace" : "^1.0"
},
"autoload" : {
"psr-4" : {
"SmartSolutionsItaly\\CakePHP\\Manifest\\" : "src"
}
},
"autoload-dev" : {
"psr-4" : {
"SmartSolutionsItaly\\CakePHP\\Manifest\\Test\\" : "tests",
"Cake\\Test\\" : "./vendor/cakephp/cakephp/tests"
}
},
"homepage" : "https://github.com/smartsolutionsitaly/cakephp-manifest",
"authors" : [{
"name" : "Lucio Benini",
"email" : "dev@smartsolutions.it",
"homepage" : "https://smartsolutions.it",
"role" : "Web Developer"
}
],
"support" : {
"email" : "info@smartsolutions.it",
"issues" : "https://github.com/smartsolutionsitaly/cakephp-manifest/issues",
"wiki" : "https://github.com/smartsolutionsitaly/cakephp-manifest/wiki",
"source" : "https://github.com/smartsolutionsitaly/cakephp-manifest"
}
}
32 changes: 32 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* cakephp-manifest (https://github.com/smartsolutionsitaly/cakephp-manifest)
* Copyright (c) 2019 Smart Solutions S.r.l. (https://smartsolutions.it)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE
* Redistributions of files must retain the above copyright notice.
*
* @category cakephp-plugin
* @package cakephp-manifest
* @author Lucio Benini <dev@smartsolutions.it>
* @copyright 2019 Smart Solutions S.r.l. (https://smartsolutions.it)
* @license https://opensource.org/licenses/mit-license.php MIT License
* @link https://smartsolutions.it Smart Solutions S.r.l.
* @since 1.0.0
*/

namespace SmartSolutionsItaly\CakePHP\Manifest\Config;

use Cake\Routing\Router;

Router::plugin('SmartSolutionsItaly/CakePHP/Manifest', function ($routes) {
$routes->connect('/manifest', ['controller' => 'manifest', 'action' => 'index'])
->setExtensions(['json']);

$routes->connect('/ieconfig', ['controller' => 'manifest', 'action' => 'ieconfig'])
->setExtensions(['xml']);

$routes->connect('/site', ['controller' => 'manifest', 'action' => 'chrome'])
->setExtensions(['webmanifest']);
});
12 changes: 12 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sonar.projectKey=cakephp-manifest
sonar.projectName=CakePHP Manifest
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=php
sonar.sourceEncoding=UTF-8
sonar.issue.ignore.multicriteria=e1
sonar.issue.ignore.multicriteria.e1.ruleKey=php:S1192
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.php
sonar.tests=tests
sonar.php.tests.reportPath=.tests/junit.xml
sonar.php.coverage.reportPath=.tests/coverage-clover.xml
73 changes: 73 additions & 0 deletions src/Controller/ManifestController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* cakephp-manifest (https://github.com/smartsolutionsitaly/cakephp-manifest)
* Copyright (c) 2019 Smart Solutions S.r.l. (https://smartsolutions.it)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE
* Redistributions of files must retain the above copyright notice.
*
* @category cakephp-plugin
* @package cakephp-manifest
* @author Lucio Benini <dev@smartsolutions.it>
* @copyright 2019 Smart Solutions S.r.l. (https://smartsolutions.it)
* @license https://opensource.org/licenses/mit-license.php MIT License
* @link https://smartsolutions.it Smart Solutions S.r.l.
* @since 1.0.0
*/

namespace SmartSolutionsItaly\CakePHP\Manifest\Controller;

use SmartSolutionsItaly\CakePHP\Manifest\Manifest;

/**
* Manifest controller.
* @package SmartSolutionsItaly\CakePHP\Manifest\Controller
* @author Lucio Benini <dev@smartsolutions.it>
* @since 1.0.0
*/
class ManifestController extends AppController
{
/**
* Handles the "index" action.
* @return \Cake\Http\Response
* @since 1.0.0
*/
public function index()
{
$manifest = Manifest::generate();

$this->set(compact($manifest));
$this->set('_serialize', [
'manifest'
]);

return $this->getResponse()
->withType('json')
->withStringBody(json_encode($manifest));
}

/**
* Generates the "ieconfig.xml" file and returns it.
* @return \Cake\Http\Response
* @since 1.0.0
*/
public function ieconfig()
{
return $this->getResponse()
->withType('xml')
->withStringBody(Manifest::ieconfig());
}

/**
* Generates the "site.webmanifest" file and returns it.
* @return \Cake\Http\Response
* @since 1.0.0
*/
public function chrome()
{
return $this->getResponse()
->withType('json')
->withStringBody(json_encode(Manifest::chrome()));
}
}
Loading

0 comments on commit 22acc98

Please sign in to comment.