Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
52eaeed
Fixing dependencies
moufmouf Jun 23, 2015
05b8288
add zend-tstratigility + remove http-kernel from dependencies
Jun 23, 2015
539a724
add zendframework/zend-diactoros into dependencies
Jun 23, 2015
a72d6c3
Adding wip message
moufmouf Jun 23, 2015
b7dc25c
convert Router to psr-7 + HtmlReponse
Jun 23, 2015
cdc62bb
Adapting Splash default router to PSR-7 and adding the router notion
moufmouf Jun 23, 2015
aa941a5
Change Symfony Request to ServerRequestInterface for PSR-7 in SplashR…
Jun 23, 2015
df93b51
Change Request to ServerRequestInterface in SplashUrlNode
Jun 23, 2015
146a138
Fix missing changes Request to ServerRequestInterface in SplashUrlNode
Jun 23, 2015
4a93576
Adding error router
moufmouf Jun 23, 2015
006030c
Improving error message
moufmouf Jun 24, 2015
5540734
Moving webservice class from splash to splash-common
moufmouf Jun 26, 2015
d96a702
Removing dependency on Fine
moufmouf Jul 6, 2015
70f90e3
Applying PSR-2
moufmouf Jul 6, 2015
26dd6d4
Resolve issue git #7
Jul 10, 2015
c6b15c7
Merge pull request #8 from Ngob/7.0
Jul 10, 2015
05949a9
WIP: converting CacheRouter
moufmouf Jul 17, 2015
c3ad153
Adding a level of indirection before looking into Mouf
moufmouf Jul 17, 2015
c60fb53
Merge branch '7.0' of git://github.com/thecodingmachine/mvc.splash-co…
moufmouf Jul 17, 2015
5f23185
Adding a level of indirection before looking into Mouf
moufmouf Jul 17, 2015
88cda9e
Removing dependencies on Fine
moufmouf Jul 17, 2015
4935c05
Fixing use
moufmouf Jul 17, 2015
b604644
Cleaning code / removing useless code
moufmouf Jul 17, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
7.0
===

- renamed 'splash' instance to 'splashMiddleware'
- 'splash' is now a PSR-7 middleware based on zendframework/stratigility
- Request and Response objects are based on zendframework/diactoros
- Switched default error router from mouf/whoops-stackphp to franzl/whoops-middleware
- In controllers, if you want to inject the request, you must now type hint against PSR-7's "ServerRequestInterface"
- In controllers, you MUST return PSR-7's ResponseInterface
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Welcome to the Splash MVC framework common library
==================================================

WORK IN PROGRESS
================

Splash 7 will be the first release to support PSR-7. It is currently in development. Meanwhile, the latest stable release
you should use is Splash 5.1.

What is Splash?
---------------

Expand Down
15 changes: 5 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"mouf/utils.cache.file-cache" : "~2.1",
"mouf/utils.common.validators" : "3.*",
"mouf/html.htmlelement" : "2.*",
"mouf/utils.i18n.fine" : "3.*",
"mouf/utils.action.common-action" : "~1.0",
"mouf/utils.common.url-interface" : "~1.0",
"mouf/html.renderer.twig-extensions": "~1.0",
"mouf/mvc.splash-implementation": "~5.0",
"symfony/http-kernel" : "~2.0",
"mouf/mvc.splash-implementation": "~7.0",
"mouf/utils.common.conditioninterface": "~2.0",
"mouf/utils.cache.cache-interface": "~2.0"
"mouf/utils.cache.cache-interface": "~2.0",
"zendframework/zend-stratigility": "~1.0",
"zendframework/zend-diactoros": "~1.0"
},
"autoload" : {
"psr-0" : {
Expand All @@ -43,14 +43,9 @@
},
"extra" : {
"mouf" : {
"install" : [{
"file" : "src/splashCommonInstall.php",
"type" : "file"
}
],
"require-admin" : [
"src/SplashCommonAdmin.php"
]
}
}
}
}
3 changes: 2 additions & 1 deletion src/Mouf/Annotations/AnnotationException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace Mouf\Annotations;

/**
/*
* Thrown when an error is detected in an annotation.
*/
use Mouf\MoufException;
Expand Down
31 changes: 15 additions & 16 deletions src/Mouf/Annotations/TitleAnnotation.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<?php

namespace Mouf\Annotations;

/**
* An annotation used to specify the Title of an action or an URL.
* Syntax: @Title My Page Title
* Syntax: @Title My Page Title.
*/
class TitleAnnotation
{
private $title;

private $title;

public function __construct($value)
{
$url = $value;
$this->title = trim($url, " \t()\"'");
}

/**
* Returns the URL
*/
public function getTitle()
{
return $this->title;
}
public function __construct($value)
{
$url = $value;
$this->title = trim($url, " \t()\"'");
}

/**
* Returns the URL.
*/
public function getTitle()
{
return $this->title;
}
}
30 changes: 15 additions & 15 deletions src/Mouf/Annotations/URLAnnotation.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?php

namespace Mouf\Annotations;

/**
* An annotation used to allow a method of a controller to be accessible from the web.
* Syntax: @URL your_url_goes_here
* Syntax: @URL your_url_goes_here.
*/
class URLAnnotation
{
private $url;

public function __construct($value)
{
$url = $value;
$this->url = trim($url, " \t()\"'");
}
private $url;

/**
* Returns the URL
*/
public function getUrl()
{
return $this->url;
}
public function __construct($value)
{
$url = $value;
$this->url = trim($url, " \t()\"'");
}

/**
* Returns the URL.
*/
public function getUrl()
{
return $this->url;
}
}
Original file line number Diff line number Diff line change
@@ -1,115 +1,111 @@
<?php

namespace Mouf\Mvc\Splash\Controllers\Admin;

use Mouf\Composer\ClassNameMapper;
use Mouf\Mvc\Splash\Controllers\Controller;
use Mouf\MoufUtils;
use Mouf\Html\Template\TemplateInterface;
use Mouf\Html\HtmlElement\HtmlBlock;
use Mouf\Html\Utils\WebLibraryManager\WebLibrary;
use Mouf\Mvc\Splash\Services\SplashCreateControllerService;
use Mouf\Mvc\Splash\Services\SplashCreateControllerServiceException;
use Mouf\Mvc\Splash\Utils\SplashException;
use Psr\Log\LoggerInterface;
use Mouf\MoufManager;
use Mouf\MoufCache;

/**
* A controller used to create controllers in Splash.
*/
class SplashCreateControllerController extends Controller
{
/**
* The template used by the Splash page.
*
* @var TemplateInterface
*/
public $template;
/**
* The template used by the Splash page.
*
* @var TemplateInterface
*/
public $template;

/**
*
* @var HtmlBlock
*/
/**
* @var HtmlBlock
*/
public $content;

protected $selfedit;
protected $controllerNamespace;
protected $autoloadDetected;

/**
* Displays the create controller page.
*
* @Action
* @param string $controllernamespace
* @param string $selfedit
*/
public function index($controllernamespace = null, $selfedit = "false")
{
$this->selfedit = $selfedit;
$this->controllerNamespace = $controllernamespace;
protected $selfedit;
protected $controllerNamespace;
protected $autoloadDetected;

/**
* Displays the create controller page.
*
* @Action
*
* @param string $controllernamespace
* @param string $selfedit
*/
public function index($controllernamespace = null, $selfedit = 'false')
{
$this->selfedit = $selfedit;
$this->controllerNamespace = $controllernamespace;

if ($this->controllerNamespace == null) {
if ($this->controllerNamespace == null) {
$classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../../composer.json');
$namespaces = $classNameMapper->getManagedNamespaces();
if ($namespaces) {
$this->autoloadDetected = true;
$rootNamespace = $namespaces[0];
$this->controllerNamespace = $rootNamespace."Controllers";
} else {
$this->autoloadDetected = false;
$this->controllerNamespace = "YourApplication\\Controllers";
}
} else {
$this->autoloadDetected = true;
}

$this->template->getWebLibraryManager()->addLibrary(new WebLibrary(
array(
"../mvc.splash-common/src/views/javascript/angular.min.js",
"../mvc.splash-common/src/views/javascript/ui-utils.min.js",
"../mvc.splash-common/src/views/javascript/createController.js"
)));
if ($namespaces) {
$this->autoloadDetected = true;
$rootNamespace = $namespaces[0];
$this->controllerNamespace = $rootNamespace.'Controllers';
} else {
$this->autoloadDetected = false;
$this->controllerNamespace = 'YourApplication\\Controllers';
}
} else {
$this->autoloadDetected = true;
}

$this->content->addFile(dirname(__FILE__)."/../../../../../views/admin/createController.php", $this);
$this->template->toHtml();
}
$this->template->getWebLibraryManager()->addLibrary(new WebLibrary(
array(
'../mvc.splash-common/src/views/javascript/angular.min.js',
'../mvc.splash-common/src/views/javascript/ui-utils.min.js',
'../mvc.splash-common/src/views/javascript/createController.js',
)));

/**
* Triggers the controller generation.
*
* @Action
* @param string $controllerName
* @param string $instanceName
* @param string $namespace
* @param string $injectLogger
* @param string $injectTemplate
* @param string $injectDaoFactory
* @param array $actions
*/
public function generate($controllerName, $instanceName, $namespace, $injectLogger = false,
$injectTemplate = false, $injectDaoFactory = false, $actions = array()) {
$this->content->addFile(dirname(__FILE__).'/../../../../../views/admin/createController.php', $this);
$this->template->toHtml();
}

$injectLogger = ($injectLogger=='false') ? false : $injectLogger;
$injectTemplate = ($injectTemplate=='false') ? false : $injectTemplate;
$injectDaoFactory = ($injectDaoFactory=='false') ? false : $injectDaoFactory;
/**
* Triggers the controller generation.
*
* @Action
*
* @param string $controllerName
* @param string $instanceName
* @param string $namespace
* @param string $injectLogger
* @param string $injectTemplate
* @param string $injectDaoFactory
* @param array $actions
*/
public function generate($controllerName, $instanceName, $namespace, $injectLogger = false,
$injectTemplate = false, $injectDaoFactory = false, $actions = array())
{
$injectLogger = ($injectLogger == 'false') ? false : $injectLogger;
$injectTemplate = ($injectTemplate == 'false') ? false : $injectTemplate;
$injectDaoFactory = ($injectDaoFactory == 'false') ? false : $injectDaoFactory;

$moufManager = MoufManager::getMoufManagerHiddenInstance();
$moufManager = MoufManager::getMoufManagerHiddenInstance();

$generatorService = new SplashCreateControllerService();
try {
$generatorService->generate($moufManager, $controllerName, $instanceName, $namespace, $injectLogger,
$injectTemplate, $injectDaoFactory, $actions);
} catch (SplashCreateControllerServiceException $e) {
$errors = $e->getErrors();
header("Content-type: application/json");
header('Content-type: application/json');
$errors['status'] = 'ko';
echo json_encode($errors);

return;
}

echo json_encode(array('status'=>'ok'));
}

echo json_encode(array('status' => 'ok'));
}
}
?>
Loading