├── doc ├── CHANGELOG.md ├── view-strategies │ ├── README.md │ ├── exception-view-strategy.md │ ├── layout-view-strategy.md │ └── scheme-view-strategy.md ├── README.md └── CONTRIBUTING.md ├── .ruby-version ├── test ├── casperjs │ ├── config │ │ └── example.js │ ├── inc │ │ └── init.js │ └── tests │ │ ├── view-home-page.js │ │ └── view-404-page.js ├── README.md └── phpunit │ ├── phpunit.xml.dist │ ├── TestConfig.php.dist │ ├── ApplicationTest │ └── Controller │ │ └── IndexControllerTest.php │ └── Bootstrap.php ├── module └── Cornerstone │ ├── language │ ├── Cornerstone_en.mo │ └── Cornerstone_en.po │ ├── view │ ├── console │ │ └── application │ │ │ ├── partials │ │ │ ├── rewrite-pre-rules.phtml │ │ │ ├── rewrite-post-rules.phtml │ │ │ └── modsec-rules.phtml │ │ │ └── vhost.tpl │ ├── layout │ │ ├── partials │ │ │ ├── page │ │ │ │ ├── footer.phtml │ │ │ │ ├── header.phtml │ │ │ │ └── content.phtml │ │ │ └── site │ │ │ │ ├── footer.phtml │ │ │ │ ├── header.phtml │ │ │ │ └── navigation.phtml │ │ ├── theme │ │ │ └── default.phtml │ │ └── layout.phtml │ ├── application │ │ └── index │ │ │ └── index.phtml │ └── error │ │ ├── index.phtml │ │ └── 404.phtml │ ├── src │ ├── Http │ │ ├── Controller │ │ │ ├── ExceptionController.php │ │ │ ├── IndexController.php │ │ │ └── NotFoundController.php │ │ ├── ViewHelper │ │ │ └── ChangeLocale.php │ │ └── Listener │ │ │ ├── ExceptionLogger.php │ │ │ ├── Layout.php │ │ │ ├── Scheme.php │ │ │ ├── Theme.php │ │ │ └── Localization.php │ ├── EventManager │ │ ├── Service.php │ │ └── Console │ │ │ └── Event.php │ └── Console │ │ ├── Listener │ │ ├── InitializeApplication.php │ │ ├── ApplicationCacheInit.php │ │ ├── ApplicationCacheEmpty.php │ │ └── BuildVirtualHost.php │ │ └── Controller │ │ └── ApplicationController.php │ ├── Module.php │ └── config │ └── module.config.php ├── .gitignore ├── config ├── autoload │ ├── vagrant.json │ ├── example_environment.json.dist │ ├── README.md │ └── global.php.dist └── application.config.php ├── metadata.rb ├── recipes └── default.rb ├── Gemfile ├── .editorconfig ├── Berksfile ├── public └── index.php ├── cornerstone.php ├── composer.json ├── Vagrantfile ├── README.md ├── Berksfile.lock ├── LICENSE └── composer.lock /doc/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.0.0-p481 -------------------------------------------------------------------------------- /test/casperjs/config/example.js: -------------------------------------------------------------------------------- 1 | var baseUrl = 'http://cornerstone.example.com/'; 2 | -------------------------------------------------------------------------------- /doc/view-strategies/README.md: -------------------------------------------------------------------------------- 1 | # View Strategies 2 | I need to add some navigation / menu items pointing to the various view strategy docs... -------------------------------------------------------------------------------- /module/Cornerstone/language/Cornerstone_en.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DivideAndConquer/Cornerstone/master/module/Cornerstone/language/Cornerstone_en.mo -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | Unit Testing 2 | =========================== 3 | 4 | I have added two example sections for building CasperJS tests and PHPUnit Tests. Feel free to use them or do your own thing. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .idea 3 | .project 4 | .vagrant 5 | .settings 6 | /config/autoload/*.php 7 | /config/autoload/*.json 8 | /cookbooks 9 | /data/cache 10 | /data/vhost 11 | /vendor 12 | -------------------------------------------------------------------------------- /module/Cornerstone/view/console/application/partials/rewrite-pre-rules.phtml: -------------------------------------------------------------------------------- 1 | 6 | 7 | SecRuleEngine DetectionOnly 8 | 9 | -------------------------------------------------------------------------------- /test/phpunit/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./ApplicationTest 5 | 6 | 7 | -------------------------------------------------------------------------------- /config/autoload/vagrant.json: -------------------------------------------------------------------------------- 1 | { 2 | "Installation": { 3 | "Vhost": { 4 | "Server": { 5 | "Region": "vagrant.www.", 6 | "Domain": "cornerstone", 7 | "Suffix": ".com" 8 | }, 9 | "Path": "/etc/apache2/sites-available/" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /config/autoload/example_environment.json.dist: -------------------------------------------------------------------------------- 1 | { 2 | "Installation": { 3 | "Vhost": { 4 | "Server": { 5 | "Region": "www.", 6 | "Domain": "oakensoul", 7 | "Suffix": ".com" 8 | }, 9 | "Path": "/etc/apache2/sites-available/" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /test/phpunit/TestConfig.php.dist: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: cornerstone 3 | # Recipe:: default 4 | # 5 | # Copyright (C) 2013, Robert G. Johnson Jr. @Oakensoul and Project Contributors listed in README.md 6 | # 7 | # Link: https://github.com/web-masons/Cornerstone for the canonical source repository 8 | # License: http://opensource.org/licenses/Apache-2.0 9 | # Package: Cornerstone 10 | # 11 | 12 | include_recipe 'cornerstone-vagrant' 13 | 14 | gem_package 'bootstrap-sass' 15 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'berkshelf', '~> 3.1.3' 4 | gem 'chef', '~> 11.12.2' 5 | gem 'chefspec', '~> 3.4' 6 | gem 'foodcritic', '~> 3.0' 7 | gem 'rake' 8 | gem 'rubocop' 9 | gem 'rspec', '~> 2.14.0' 10 | 11 | group :development do 12 | gem 'guard' 13 | gem 'guard-rspec' 14 | gem 'guard-kitchen' 15 | gem 'guard-rubocop' 16 | gem 'guard-foodcritic' 17 | gem 'ruby_gntp' 18 | gem 'travis' 19 | gem 'travis-lint' 20 | end 21 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 4 12 | tab_width = 4 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/partials/page/header.phtml: -------------------------------------------------------------------------------- 1 | 11 | 16 | -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/partials/site/footer.phtml: -------------------------------------------------------------------------------- 1 | 11 | 12 |
13 | 14 | 19 | -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/partials/page/content.phtml: -------------------------------------------------------------------------------- 1 | partial('layout/partials/page/header'); 11 | ?> 12 | 13 |
14 | content; ?> 15 |
16 | 17 | partial('layout/partials/page/footer'); ?> 18 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Controller/ExceptionController.php: -------------------------------------------------------------------------------- 1 | ] => 'path to layout'; 13 | 14 | $router['routes']['']['options']['default'][layout'] = '' 15 | 16 | ``` 17 | 18 | Keep in mind, this will affect all child routes of the configured route. If no `layout` 19 | is provided the default layout is used. 20 | -------------------------------------------------------------------------------- /doc/view-strategies/scheme-view-strategy.md: -------------------------------------------------------------------------------- 1 | # Scheme View Strategy 2 | The base Cornerstone module registers the "View\Http\SchemeStrategy" for handling 3 | SSL traffic. When ssl route enforcement is enabled, the strategy will take any 4 | port 80 traffic and force it to the appropriate route over SSL. 5 | 6 | This can also be enabled by wrapping it in a check to see if the user is authenticated, 7 | since you likely won't want SSL enforced all the time. (Though you can if you need/want.) 8 | 9 | ## Configuration 10 | To enable or disable SSL forwarding for any route, configure the following: 11 | 12 | $config['routes']['example']['options']['defaults']['force_https_scheme'] = true | false; 13 | 14 | Keep in mind, this will affect all child routes of the configured route. 15 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | This folder is for placing any module or application specific documentation. Since this 3 | file will automatically display when you view the folder from the GitHub web page, 4 | it should be used as a high level table of contents and collation of feature sets. 5 | 6 | An off the top of my head list of topics that would be good: 7 | 8 | ## General Documentation 9 | * Getting Started 10 | * Configuration 11 | Event Manager 12 | Routing 13 | Logging 14 | Exception Handling 15 | 16 | ## Http MVC Documentation 17 | * Navigation 18 | * Adding New Controllers 19 | * Adding Views 20 | * Updating the Layout 21 | * View Strategies 22 | 23 | ## Console MVC Documentation 24 | * Getting Started 25 | * Usage 26 | * Listeners 27 | * Adding New Commands 28 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://api.berkshelf.com' 2 | 3 | metadata 4 | 5 | cookbook 'cornerstone-vagrant', git: 'https://github.com/web-masons/cornerstone-vagrant-cookbook.git' 6 | cookbook 'apt' 7 | cookbook 'build-essential' 8 | cookbook 'composer' 9 | cookbook 'apache2', '= 1.10.4' 10 | cookbook 'platform_packages' 11 | 12 | cookbook 'php-webserver', git: 'https://github.com/turbine-web/php-webserver.git' 13 | cookbook 'web-developer-cookbook', git: 'https://github.com/turbine-web/web-developer-cookbook.git' 14 | cookbook 'git', git: 'https://github.com/jssjr/git.git' 15 | cookbook 'nodejs', git: 'https://github.com/redguide/nodejs.git' 16 | cookbook 'grunt_cookbook', git: 'https://github.com/MattSurabian/grunt_cookbook.git' 17 | cookbook 'chef-ruby-ppa', git: 'https://github.com/oakensoul/chef-ruby-ppa.git' 18 | -------------------------------------------------------------------------------- /test/casperjs/inc/init.js: -------------------------------------------------------------------------------- 1 | var errorCount = 0; 2 | var screenBase = 'error-screens/'; 3 | var viewportSize = {width: 1280, height: 1024}; 4 | 5 | casper.options.viewportSize = viewportSize; 6 | 7 | if(undefined === scriptname) 8 | { 9 | var scriptname = Date.now(); 10 | } 11 | 12 | casper.test.on("fail", function(failure) { 13 | casper.capture(screenBase + scriptname + '-' + errorCount + '.png'); 14 | casper.echo('Test Failure - screenshot: ' + screenBase + scriptname + '-' + errorCount + '.png', 'TRACE'); 15 | errorCount++; 16 | }); 17 | 18 | casper.options.onWaitTimeout = function() { 19 | casper.capture(screenBase + scriptname + '-' + errorCount + '.png'); 20 | casper.echo('Timeout Failure - screenshot: ' + screenBase + scriptname + '-' + errorCount + '.png', 'TRACE'); 21 | errorCount++; 22 | }; 23 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Controller/IndexController.php: -------------------------------------------------------------------------------- 1 | setTemplate('application/index/index'); 22 | 23 | return $view; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Controller/NotFoundController.php: -------------------------------------------------------------------------------- 1 | getResponse(); 21 | $response->setStatusCode(404); 22 | 23 | return $response; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | run(); 29 | -------------------------------------------------------------------------------- /cornerstone.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | =5.4", 14 | "zendframework/zendframework": ">=2.2" 15 | }, 16 | "require-dev": { 17 | "phpunit/phpunit": "3.7.*" 18 | }, 19 | "minimum-stability": "stable", 20 | "autoload": { 21 | "psr-0": { 22 | "Cornerstone\\" : "./module/Cornerstone/src/" 23 | }, 24 | "classmap": [ 25 | "./module/Cornerstone/Module.php" 26 | ] 27 | }, 28 | "repositories": [ 29 | { 30 | "type": "composer", 31 | "url": "https://packages.zendframework.com/" 32 | } 33 | ], 34 | "scripts" : { 35 | "post-install-cmd" : [ 36 | ], 37 | "post-update-cmd" : [ 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /module/Cornerstone/src/EventManager/Console/Event.php: -------------------------------------------------------------------------------- 1 | mVerboseFlag = true === $pVerbose ? true : false; 26 | } 27 | 28 | public function getVerboseFlag () 29 | { 30 | return $this->mVerboseFlag; 31 | } 32 | 33 | public function setForceFlag ($pForce) 34 | { 35 | $this->mForceFlag = true === $pForce ? true : false; 36 | } 37 | 38 | public function getForceFlag () 39 | { 40 | return $this->mForceFlag; 41 | } 42 | 43 | public function setEnvironment ($pEnvironment) 44 | { 45 | $this->mEnvironment = $pEnvironment; 46 | } 47 | 48 | public function getEnvironment () 49 | { 50 | return $this->mEnvironment; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/theme/default.phtml: -------------------------------------------------------------------------------- 1 | headTitle()->setSeparator(' : '); 12 | $this->headTitle()->setAutoEscape(false); 13 | 14 | $this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1.0'); 15 | $this->headMeta()->setCharset("utf-8"); 16 | 17 | // I'm still not 100% sold that I even want to keep the theme system. I think I do, just for 18 | // ease of implementing things like site wrap take-overs but i'm just not sure. 19 | 20 | $link = array(); 21 | $link['rel'] = 'stylesheet'; 22 | $link['type'] = 'text/css'; 23 | $link['media'] = 'screen'; 24 | $link['href'] = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'; 25 | $this->headLink($link, 'APPEND'); 26 | 27 | $link['href'] = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css'; 28 | $this->headLink($link, 'APPEND'); 29 | 30 | $this->inlinescript()->appendFile('https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', 'text/javascript'); 31 | $this->inlinescript()->appendFile('https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js', 'text/javascript'); 32 | -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/partials/site/header.phtml: -------------------------------------------------------------------------------- 1 | navigation()->menu(); 15 | $menu->setPartial($partial); 16 | ?> 17 | 35 | -------------------------------------------------------------------------------- /config/autoload/README.md: -------------------------------------------------------------------------------- 1 | # Environment Configuration Files 2 | 3 | ## Introduction 4 | The application skeleton is configured by default to support two different kinds of "autoload" 5 | configuration. The Global configuration and Environment specific configuration. 6 | 7 | ## Global Configuration 8 | The Global configuration file is for exactly what you think it might be. Global configuration for 9 | the ZF2 application. The only words of wisdom (?) here would be to keep as much out of the global 10 | configuration and in module configuration as possible. These values really should represent the 11 | bare minimum of mandatory overrides from module configuration or things that really can't be 12 | defined in module configuration (and aren't environment specific). 13 | 14 | ## Environment Specific Configuration 15 | The environment specific configuration files are for settings that change between your development 16 | and your testing or production environments. This is a good place to put data access locations such 17 | as database settings etc. For those of you that don't like to check in your environment specific 18 | settings into source control, you can create a local.php and add it to your .gitignore. 19 | 20 | The other item of note is that I chose to use json files for environment specific configuration so 21 | that other non-php applications could potentially read them. If you don't need or want json config 22 | files you can simply update your application.config.php file and change the extension to .php instead 23 | of .json and it should all just work. -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/partials/site/navigation.phtml: -------------------------------------------------------------------------------- 1 | 11 | 33 | -------------------------------------------------------------------------------- /module/Cornerstone/view/layout/layout.phtml: -------------------------------------------------------------------------------- 1 | headTitle($this->translate('Cornerstone Module'), 'APPEND'); 11 | $this->headTitle($this->translate('Oakensoul'), 'APPEND'); 12 | 13 | echo $this->doctype(); 14 | ?> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | headTitle() . "\n\n"; ?> 27 | headMeta() . "\n\n"; ?> 28 | headLink() . "\n\n"; ?> 29 | headScript() . "\n\n"; ?> 30 | 31 | 32 | 33 | partial( 'layout/partials/site/header' ); ?> 34 | 35 | partial( 'layout/partials/page/content' ); ?> 36 | 37 | partial( 'layout/partials/site/footer' ); ?> 38 | 39 | inlinescript(); ?> 40 | 41 | 42 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Console/Listener/InitializeApplication.php: -------------------------------------------------------------------------------- 1 | listeners[] = $pEventManager->attach(Service::EVENT_APPLICATION_INITIALIZE, $options, 1); 32 | } 33 | 34 | public function EventHandler (Console\Event $pEvent) 35 | { 36 | // process event 37 | } 38 | 39 | /** 40 | * Set service locator 41 | * 42 | * @param ServiceManager\ServiceLocatorInterface $serviceLocator 43 | */ 44 | public function setServiceLocator (ServiceManager\ServiceLocatorInterface $serviceLocator) 45 | { 46 | $this->mServiceLocator = $serviceLocator; 47 | } 48 | 49 | /** 50 | * Get service locator 51 | * 52 | * @return ServiceManager\ServiceLocatorInterface 53 | */ 54 | public function getServiceLocator () 55 | { 56 | return $this->mServiceLocator; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /test/phpunit/ApplicationTest/Controller/IndexControllerTest.php: -------------------------------------------------------------------------------- 1 | controller = new IndexController(); 30 | $this->request = new Request(); 31 | $this->routeMatch = new RouteMatch(array ( 32 | 'controller' => 'index' 33 | )); 34 | $this->event = new MvcEvent(); 35 | $config = $serviceManager->get('Config'); 36 | $routerConfig = isset($config['router']) ? $config['router'] : array (); 37 | $router = HttpRouter::factory($routerConfig); 38 | 39 | $this->event->setRouter($router); 40 | $this->event->setRouteMatch($this->routeMatch); 41 | $this->controller->setEvent($this->event); 42 | $this->controller->setServiceLocator($serviceManager); 43 | } 44 | 45 | public function testIndexActionCanBeAccessed () 46 | { 47 | $this->routeMatch->setParam('action', 'index'); 48 | 49 | $result = $this->controller->dispatch($this->request); 50 | 51 | /* @var $response Response */ 52 | $response = $this->controller->getResponse(); 53 | 54 | $this->assertEquals(200, $response->getStatusCode()); 55 | } 56 | } -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/ViewHelper/ChangeLocale.php: -------------------------------------------------------------------------------- 1 | getServiceLocator()->getServiceLocator(); 25 | 26 | $router = $sm->get('router'); 27 | $request = $sm->get('request'); 28 | 29 | $match = $router->match($request); 30 | 31 | if (is_null($match)) 32 | { 33 | /* we hit a 404 */ 34 | $params['lang'] = $pLocale; 35 | $options['name'] = 'home'; 36 | } 37 | else 38 | { 39 | $match->setParam('lang', $pLocale); 40 | $params = $match->getParams(); 41 | $options['name'] = $match->getMatchedRouteName(); 42 | } 43 | 44 | $url = $router->assemble($params, $options); 45 | 46 | return $url; 47 | } 48 | 49 | public function setServiceLocator (ServiceLocatorInterface $serviceLocator) 50 | { 51 | $this->mServiceLocator = $serviceLocator; 52 | } 53 | 54 | public function getServiceLocator () 55 | { 56 | return $this->mServiceLocator; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /test/casperjs/tests/view-home-page.js: -------------------------------------------------------------------------------- 1 | var url = baseUrl; 2 | var scriptname = 'view-home-page'; 3 | 4 | casper.start(url, function () 5 | { 6 | casper.test.info("URL: " + url); 7 | 8 | }); 9 | 10 | casper.then(function () 11 | { 12 | casper.test.info("\n--------------------------------------------"); 13 | casper.test.info("GIVEN: an unauthenticated user"); 14 | casper.test.info(" WHEN: they visit the home page"); 15 | casper.test.info(" THEN: They should receive a 200 http status"); 16 | 17 | this.test.assertHttpStatus(200); 18 | }); 19 | 20 | casper.then(function () 21 | { 22 | casper.test.info("\n--------------------------------------------"); 23 | casper.test.info("GIVEN: an unauthenticated user"); 24 | casper.test.info(" WHEN: they visit the home page"); 25 | casper.test.info(" THEN: The charset should be set to UTF-8."); 26 | 27 | this.test.assertSelectorExists('meta[name="charset"]', 'Check for meta tag charset.'); 28 | this.test.assertSelectorExists('meta[name="charset"][content="utf-8"]', 'Check charset should be set to utf-8'); 29 | }); 30 | 31 | casper.then(function () 32 | { 33 | casper.test.info("\n--------------------------------------------"); 34 | casper.test.info("GIVEN: an unauthenticated user"); 35 | casper.test.info(" WHEN: they visit a page that does not exist"); 36 | casper.test.info(" THEN: They see a page with a header."); 37 | 38 | this.test.assertExists('header', 'Header section exists.'); 39 | }); 40 | 41 | casper.then(function () 42 | { 43 | casper.test.info("\n--------------------------------------------"); 44 | casper.test.info("GIVEN: an unauthenticated user"); 45 | casper.test.info(" WHEN: they visit the home page"); 46 | casper.test.info(" THEN: They see a home page with a footer."); 47 | 48 | this.test.assertExists('footer', 'Footer section exists.'); 49 | }); 50 | 51 | casper.run(function () 52 | { 53 | casper.test.info("\n--------------------------------------------"); 54 | casper.test.done(); 55 | }); -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Listener/ExceptionLogger.php: -------------------------------------------------------------------------------- 1 | listeners[] = $events->attach(Mvc\MvcEvent::EVENT_DISPATCH_ERROR, $options, 100); 33 | } 34 | 35 | /** 36 | * When ZF2 encounters an unhandled exception, it will return a 500 37 | * and potentially write it to the screen. However, it never makes 38 | * it into the apache error logs (and it really should). 39 | * 40 | * @param Mvc\MvcEvent $pEvent 41 | * @return null 42 | */ 43 | public function onDispatchError (Mvc\MvcEvent $pEvent) 44 | { 45 | $request = $pEvent->getRequest(); 46 | 47 | // Make sure that we are not running in a console 48 | if ($request instanceof Console\Request) 49 | { 50 | return NULL; 51 | } 52 | 53 | /** bail out if we're not processing an exception */ 54 | if (Mvc\Application::ERROR_EXCEPTION != $pEvent->getError()) 55 | { 56 | return NULL; 57 | } 58 | 59 | $e = $pEvent->getParam('exception'); 60 | error_log($e->getMessage(), E_USER_ERROR); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /test/casperjs/tests/view-404-page.js: -------------------------------------------------------------------------------- 1 | var url = baseUrl + 'not-found/'; 2 | var scriptname = 'view-404-page'; 3 | 4 | casper.start(url, function() 5 | { 6 | casper.test.info("URL: " + url); 7 | 8 | }); 9 | 10 | casper.then(function() 11 | { 12 | casper.test.info("\n--------------------------------------------"); 13 | casper.test.info("GIVEN: an unauthenticated user"); 14 | casper.test.info(" WHEN: they visit a page that does not exist"); 15 | casper.test.info(" THEN: They should receive a 404 http status"); 16 | 17 | this.test.assertHttpStatus(404); 18 | }); 19 | 20 | casper.then(function() 21 | { 22 | casper.test.info("\n--------------------------------------------"); 23 | casper.test.info("GIVEN: an unauthenticated user"); 24 | casper.test.info(" WHEN: they visit a page that does not exist"); 25 | casper.test.info(" THEN: The charset should be set to UTF-8."); 26 | 27 | this.test.assertSelectorExists('meta[name="charset"]', 28 | 'Check for meta tag charset.'); 29 | this.test.assertSelectorExists('meta[name="charset"][content="utf-8"]', 30 | 'Check charset should be set to utf-8'); 31 | }); 32 | 33 | casper.then(function () 34 | { 35 | casper.test.info("\n--------------------------------------------"); 36 | casper.test.info("GIVEN: an unauthenticated user"); 37 | casper.test.info(" WHEN: they visit a page that does not exist"); 38 | casper.test.info(" THEN: They see a page with a header."); 39 | 40 | this.test.assertExists('header', 'Header section exists.'); 41 | }); 42 | 43 | casper.then(function() 44 | { 45 | casper.test.info("\n--------------------------------------------"); 46 | casper.test.info("GIVEN: an unauthenticated user"); 47 | casper.test.info(" WHEN: they visit a page that does not exist"); 48 | casper.test.info(" THEN: They see a page with a footer."); 49 | 50 | this.test.assertExists('footer', 'Footer section exists.'); 51 | }); 52 | 53 | casper.run(function() 54 | { 55 | casper.test.info("\n--------------------------------------------"); 56 | casper.test.done(); 57 | }); -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Listener/Layout.php: -------------------------------------------------------------------------------- 1 | listeners[] = $events->attach(MvcEvent::EVENT_RENDER, $options, 100); 39 | } 40 | 41 | public function onRender (MvcEvent $pEvent) 42 | { 43 | $request = $pEvent->getRequest(); 44 | 45 | // Make sure that we are not running in a console 46 | if ($request instanceof Console\Request) 47 | { 48 | return; 49 | } 50 | 51 | /* @var $match RouteMatch */ 52 | $match = $pEvent->getRouteMatch(); 53 | 54 | if ( false === is_object($match)) 55 | { 56 | /** if there's no route match, we're in a 404 state, abort */ 57 | return; 58 | } 59 | 60 | $layout = $match->getParam('layout'); 61 | 62 | /** 63 | * This code allows for route configuration based layout overrides 64 | */ 65 | if (false === empty($layout)) 66 | { 67 | $pEvent->getViewModel()->setTemplate($layout); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /config/autoload/global.php.dist: -------------------------------------------------------------------------------- 1 | array ( 49 | 'Vhost' => array ( 50 | 'Server' => array ( 51 | 'Domain' => 'example', 52 | 'Region' => 'cornerstone.', 53 | "Suffix": ".com" 54 | ) 55 | ) 56 | ) 57 | ); -------------------------------------------------------------------------------- /module/Cornerstone/view/application/index/index.phtml: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 |
16 |

Getting Started with Cornerstone

17 |

A ZF2 Application Blueprint for building new PHP web apps using Cornerstone

18 |
19 | 20 |
21 | 22 |
23 | 24 |
25 |

Welcome!

26 | 27 | 28 |

If you're seeing this, you've either installed Cornerstone or created a new project using our Application Blueprint, Welcome! You've managed to get through installation, now it's time to get down to the fun part, building stuff.

29 |

A handful of us have decided to create our own GitHub organization and place a collection of our various code projects into it, thus https://github.com/web-masons/ was born.

30 |

If you need assistance, please file an Issue to the project and we'll get back to you as soon as we can. If you're not sure which project to file it under, just file it under the Cornerstone project.

31 |
32 | 33 |
34 | 35 |
36 | 42 |
43 | 44 |
45 | 46 |
47 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = "2" 5 | 6 | boxes = { 7 | 'php' => { 8 | :box => 'ubuntu1204-chef1144', 9 | :boxurl => 'https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.4.box', 10 | :recipes => [ 11 | 'cornerstone::default' 12 | ], 13 | :json => { 14 | 'cornerstone-vagrant' => { 15 | 'project' => 'cornerstone', 16 | 'siteslug' => 'vagrant.www.cornerstone' 17 | } 18 | } 19 | } 20 | } 21 | 22 | # define servers 23 | servers = [ 24 | { 25 | :hostname => 'vagrant.www.cornerstone.com', 26 | :ip => '192.168.2.2', 27 | :type => 'php', 28 | :primary => true 29 | } 30 | ] 31 | 32 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 33 | 34 | #Setup hostmanager config to update the host files 35 | config.hostmanager.enabled = true 36 | config.hostmanager.manage_host = true 37 | config.hostmanager.ignore_private_ip = false 38 | config.hostmanager.include_offline = true 39 | config.vm.provision :hostmanager 40 | 41 | # Enable Synced Folders 42 | config.vm.synced_folder ".", "/vagrant" 43 | 44 | # Forward SSH Keys 45 | config.ssh.forward_agent = true 46 | 47 | # Berkshelf all the things 48 | [:up, :provision].each do |cmd| 49 | config.trigger.before cmd, :stdout => true do 50 | info 'Cleaning cookbook directory' 51 | run "rm -rf cookbooks" 52 | info 'Installing cookbook dependencies with berkshelf' 53 | run "berks vendor cookbooks" 54 | end 55 | end 56 | 57 | # Loop through all servers and configure them 58 | servers.each do |server| 59 | config.vm.define server[:hostname], primary: server[:primary] do |node_config| 60 | node_config.vm.box = boxes[server[:type]][:box] 61 | node_config.vm.box_url = boxes[server[:type]][:boxurl] 62 | node_config.vm.hostname = server[:hostname] 63 | node_config.vm.network :private_network, ip: server[:ip] 64 | 65 | node_config.hostmanager.aliases = server[:hostname] 66 | 67 | node_config.vm.provision :chef_solo do |chef| 68 | chef.cookbooks_path = [ 69 | "cookbooks" 70 | ] 71 | 72 | chef.json = boxes[server[:type]][:json] 73 | 74 | boxes[server[:type]][:recipes].each do |recipe| 75 | chef.add_recipe recipe 76 | end 77 | end 78 | 79 | end 80 | end 81 | 82 | end 83 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Listener/Scheme.php: -------------------------------------------------------------------------------- 1 | listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, $options, 100); 35 | } 36 | 37 | public function onDispatch (MvcEvent $pEvent) 38 | { 39 | $request = $pEvent->getRequest(); 40 | 41 | // Make sure that we are not running in a console 42 | if ($request instanceof Request) 43 | { 44 | /* @var \Zend\Mvc\Router\Http\RouteMatch $match */ 45 | $match = $pEvent->getRouteMatch(); 46 | 47 | /** 48 | * This code basically just makes sure that when we dispatch 49 | * a route the user is forced to SSL if the route is configured 50 | * to enable the feature 51 | */ 52 | if (true === $match->getParam('force_https_scheme', false)) 53 | { 54 | $uri = $request->getUri(); 55 | 56 | if ($uri->getScheme() !== "https") 57 | { 58 | $uri->setScheme('https'); 59 | 60 | /* @var \Zend\Http\PhpEnvironment\Response $response */ 61 | $response = $pEvent->getResponse(); 62 | 63 | $response->setStatusCode(302); 64 | $response->getHeaders()->addHeaderLine('Location', $uri); 65 | $response->sendHeaders(); 66 | return $response; 67 | } 68 | } 69 | } 70 | 71 | return NULL; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Listener/Theme.php: -------------------------------------------------------------------------------- 1 | listeners[] = $events->attach(MvcEvent::EVENT_RENDER, $options, 100); 37 | } 38 | 39 | public function onRender (MvcEvent $pEvent) 40 | { 41 | $request = $pEvent->getRequest(); 42 | 43 | // Make sure that we are not running in a console 44 | if ($request instanceof Console\Request) 45 | { 46 | return; 47 | } 48 | 49 | $application = $pEvent->getApplication(); 50 | 51 | // Getting the view helper manager from the application service manager 52 | $view_helper_manager = $application->getServiceManager()->get('viewHelperManager'); 53 | 54 | /* @var $match RouteMatch */ 55 | $match = $pEvent->getRouteMatch(); 56 | 57 | if ( false === is_object($match)) 58 | { 59 | /** if there's no route match, we're in a 404 state, abort */ 60 | return; 61 | } 62 | 63 | $theme = $match->getParam('theme'); 64 | 65 | /** 66 | * This code basically allows a very rudimentary "theme switcher". Themes 67 | * can be switched via routes in the route stack. 68 | */ 69 | if (false === empty($theme)) 70 | { 71 | $partial = $view_helper_manager->get('partial'); 72 | 73 | /* the layout theme files should be placed in src/view/layout/theme/{theme}.phtml */ 74 | $partial('layout/theme/' . $theme); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cornerstone 2 | Cornerstone is a Zend Framework 2 module that is meant to replace the 3 | default Application module that the ZF2 skeleton application starts with. 4 | 5 | It has been created to provide a default set of tools that many sites 6 | can build from. The hope is that it will provide a collection of base 7 | tools and utilities to standardize the creation of ZF2 Modules and 8 | Applications while also making getting started easier. 9 | 10 | You will likely notice that this Module is also itself a standalone 11 | "site" that can be configured and run. All of my modules that I develop 12 | are built upon Cornerstone so that each of them can be as independent 13 | as possible and aren't themselves required to be composed into another 14 | module to make sure they work. When composed into another application 15 | however, it will work exactly as any other ZF2 module would and will 16 | not need to be specifically configured (though your parent application 17 | will be). 18 | 19 | ## Requirements 20 | This module requires the use of Composer and Zend Framework 2.2 or 21 | higher. You will find additional software requirements in the 22 | packaged composer.json file. 23 | 24 | ## Usage 25 | 26 | ### Creating a new Site using Cornerstone 27 | It is recommended that any site built to use Cornerstone be built on 28 | the Cornerstone [application blueprint](https://github.com/web-masons/application-blueprint) 29 | from [Packagist](https://packagist.org/packages/web-masons/application-blueprint). 30 | 31 | ``` 32 | composer create-project web-masons/application-blueprint 33 | ``` 34 | 35 | ### Adding Cornerstone to your existing project 36 | If you are not using the application-blueprint above, then you should be 37 | composing in Cornerstone. To do so, add lines similar to the following 38 | to your project's composer.json file. 39 | 40 | ``` 41 | "require": { 42 | "php": ">=5.4", 43 | "zendframework/zendframework": ">=2.2", 44 | "web-masons/Cornerstone" : "0.*", 45 | }, 46 | 47 | "repositories": [ { 48 | "type": "vcs", 49 | "url": "https://github.com/web-masons/Cornerstone" 50 | }], 51 | 52 | ``` 53 | ## Documentation 54 | All documentation can be found in the [doc](doc) folder. 55 | 56 | ## Contributors 57 | 58 | Collaborators: 59 | * [@Oakensoul](https://github.com/oakensoul) 60 | 61 | 62 | ## Contributing 63 | 64 | * [Getting Started](doc/CONTRIBUTING.md) 65 | * [Bug Reports](doc/CONTRIBUTING.md#bug-reports) 66 | * [Feature Requests](doc/CONTRIBUTING.md#feature-requests) 67 | * [Pull Requests](doc/CONTRIBUTING.md#pull-requests) 68 | 69 | # LICENSE 70 | This module is licensed using the Apache-2.0 License: 71 | 72 | ``` 73 | Copyright (c) 2013, github.com/web-masons Contributors 74 | ``` 75 | -------------------------------------------------------------------------------- /module/Cornerstone/view/error/index.phtml: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
15 |

translate('An error occurred') ?>

16 |

message ?>

17 | 18 | display_exceptions) && $this->display_exceptions): ?> 19 | 20 | exception) && $this->exception instanceof Exception): ?> 21 |
22 |

translate('Additional information') ?>:

23 |

exception); ?>

24 |
25 |
translate('File') ?>:
26 |
27 |
exception->getFile() ?>:exception->getLine() ?>
28 |
29 |
translate('Message') ?>:
30 |
31 |
exception->getMessage() ?>
32 |
33 |
translate('Stack trace') ?>:
34 |
35 |
exception->getTraceAsString() ?>
36 |
37 |
38 | exception->getPrevious(); 41 | if ($e) : 42 | ?> 43 |
44 |

translate('Previous exceptions') ?>:

45 |
    46 | 47 |
  • 48 |

    49 |
    50 |
    translate('File') ?>:
    51 |
    52 |
    getFile() ?>:getLine() ?>
    53 |
    54 |
    translate('Message') ?>:
    55 |
    56 |
    getMessage() ?>
    57 |
    58 |
    translate('Stack trace') ?>:
    59 |
    60 |
    getTraceAsString() ?>
    61 |
    62 |
    63 |
  • 64 | getPrevious(); 66 | endwhile; 67 | ?> 68 |
69 | 70 | 71 | 72 | 73 |

translate('No Exception available') ?>

74 | 75 | 76 | 77 | 78 |
79 |
80 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Http/Listener/Localization.php: -------------------------------------------------------------------------------- 1 | listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, $options, 100); 35 | } 36 | 37 | public function onDispatch (MvcEvent $pEvent) 38 | { 39 | $request = $pEvent->getRequest(); 40 | 41 | // Make sure that we are not running in a console 42 | if ($request instanceof Console\Request) 43 | { 44 | return NULL; 45 | } 46 | 47 | /* @var \Zend\Mvc\Router\RouteMatch $match */ 48 | $match = $pEvent->getRouteMatch(); 49 | 50 | /* locale selected */ 51 | $lang_selected = $match->getParam('lang'); 52 | 53 | $default_language = 'en'; 54 | 55 | /** 56 | * This code basically just makes sure that when we dispatch 57 | * a route the user is forced to use a localized route if the 58 | * system is configured to enable the feature 59 | */ 60 | if (is_null($lang_selected) && true === $match->getParam('force_localized_route', false)) 61 | { 62 | /* @var $router TreeRouteStack */ 63 | $router = $pEvent->getRouter(); 64 | 65 | /* @todo remove hard coded 'en' default language */ 66 | $params = $match->getParams(); 67 | $params['lang'] = $default_language; 68 | 69 | $options = array (); 70 | $options['name'] = $match->getMatchedRouteName(); 71 | 72 | $url = $router->assemble($params, $options); 73 | 74 | /* @var \Zend\Http\PhpEnvironment\Response $response */ 75 | $response = $pEvent->getResponse(); 76 | 77 | $response->setStatusCode(302); 78 | $response->getHeaders()->addHeaderLine('Location', $url); 79 | $response->sendHeaders(); 80 | return $response; 81 | } 82 | 83 | if (empty($lang_selected)) 84 | { 85 | $lang_selected = $default_language; 86 | } 87 | 88 | Locale::setDefault($lang_selected); 89 | 90 | return NULL; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Berksfile.lock: -------------------------------------------------------------------------------- 1 | DEPENDENCIES 2 | apache2 (= 1.10.4) 3 | apt 4 | build-essential 5 | chef-ruby-ppa 6 | git: https://github.com/oakensoul/chef-ruby-ppa.git 7 | revision: db7880d19e44353aa0afb7bc964ff4205e16af2c 8 | composer 9 | cornerstone 10 | path: . 11 | metadata: true 12 | cornerstone-vagrant 13 | git: https://github.com/web-masons/cornerstone-vagrant-cookbook.git 14 | revision: 7bff84fa0d2d663e88aa368c3e6cff288a77aa77 15 | git 16 | git: https://github.com/jssjr/git.git 17 | revision: b1bca76aaf3a3a2131744f17f6e5087e22fa3c40 18 | grunt_cookbook 19 | git: https://github.com/MattSurabian/grunt_cookbook.git 20 | revision: b3f543346cfbb99d83baff6604dcef595254e777 21 | nodejs 22 | git: https://github.com/redguide/nodejs.git 23 | revision: 91d8d11f189d13815d56af5700168e1cad88ae7f 24 | php-webserver 25 | git: https://github.com/turbine-web/php-webserver.git 26 | revision: 8be1397d1e06e610eb4218c1087feefecf5d9817 27 | platform_packages 28 | web-developer-cookbook 29 | git: https://github.com/turbine-web/web-developer-cookbook.git 30 | revision: f317e48ddec231dbdd8252d41474a927fef0d75d 31 | 32 | GRAPH 33 | 7-zip (1.0.2) 34 | windows (>= 1.2.2) 35 | apache2 (1.10.4) 36 | iptables (>= 0.0.0) 37 | logrotate (>= 0.0.0) 38 | pacman (>= 0.0.0) 39 | apt (2.5.3) 40 | ark (0.9.0) 41 | 7-zip (>= 0.0.0) 42 | windows (>= 0.0.0) 43 | build-essential (2.0.6) 44 | chef-ruby-ppa (1.0.0) 45 | apt (>= 0.0.0) 46 | chef-sugar (2.2.0) 47 | chef_gem (0.1.0) 48 | chef_handler (1.1.6) 49 | composer (1.0.4) 50 | php (>= 0.0.0) 51 | windows (>= 0.0.0) 52 | cornerstone (1.0.0) 53 | cornerstone-vagrant (>= 0.0.0) 54 | php-webserver (>= 0.0.0) 55 | web-developer-cookbook (>= 0.0.0) 56 | cornerstone-vagrant (1.0.0) 57 | php-webserver (>= 0.0.0) 58 | platform_packages (>= 0.0.0) 59 | web-developer-cookbook (>= 0.0.0) 60 | dmg (2.2.0) 61 | git (4.0.3) 62 | build-essential (>= 0.0.0) 63 | dmg (>= 0.0.0) 64 | runit (>= 1.0.0) 65 | windows (>= 0.0.0) 66 | yum (~> 3.0) 67 | yum-epel (>= 0.0.0) 68 | grunt_cookbook (1.0.0) 69 | nodejs (>= 0.0.0) 70 | iis (2.1.2) 71 | windows (>= 1.2.6) 72 | iptables (0.14.0) 73 | java (1.27.0) 74 | logrotate (1.6.0) 75 | mysql (5.4.4) 76 | yum-mysql-community (>= 0.0.0) 77 | nodejs (2.1.1) 78 | apt (>= 0.0.0) 79 | ark (>= 0.0.0) 80 | build-essential (>= 0.0.0) 81 | yum-epel (>= 0.0.0) 82 | pacman (1.1.1) 83 | php (1.4.6) 84 | build-essential (>= 0.0.0) 85 | iis (>= 0.0.0) 86 | mysql (>= 0.0.0) 87 | windows (>= 0.0.0) 88 | xml (>= 0.0.0) 89 | yum-epel (>= 0.0.0) 90 | php-webserver (1.0.0) 91 | apache2 (>= 0.0.0) 92 | apt (>= 0.0.0) 93 | build-essential (>= 0.0.0) 94 | composer (>= 0.0.0) 95 | platform_packages (0.4.2) 96 | runit (1.5.10) 97 | build-essential (>= 0.0.0) 98 | yum (~> 3.0) 99 | yum-epel (>= 0.0.0) 100 | rvm (0.9.2) 101 | chef_gem (>= 0.0.0) 102 | java (>= 0.0.0) 103 | web-developer-cookbook (1.0.2) 104 | chef-ruby-ppa (>= 0.0.0) 105 | git (>= 0.0.0) 106 | grunt_cookbook (>= 0.0.0) 107 | nodejs (>= 0.0.0) 108 | rvm (>= 0.0.0) 109 | windows (1.34.2) 110 | chef_handler (>= 0.0.0) 111 | xml (1.2.6) 112 | build-essential (>= 0.0.0) 113 | chef-sugar (>= 0.0.0) 114 | yum (3.2.4) 115 | yum-epel (0.4.0) 116 | yum (~> 3.0) 117 | yum-mysql-community (0.1.10) 118 | yum (>= 3.0) 119 | -------------------------------------------------------------------------------- /test/phpunit/Bootstrap.php: -------------------------------------------------------------------------------- 1 | array ( 59 | 'module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths) 60 | ) 61 | ); 62 | 63 | $config = ArrayUtils::merge($baseConfig, $test_config); 64 | 65 | $serviceManager = new ServiceManager(new ServiceManagerConfig()); 66 | $serviceManager->setService('ApplicationConfig', $config); 67 | $serviceManager->get('ModuleManager')->loadModules(); 68 | 69 | static::$serviceManager = $serviceManager; 70 | static::$config = $config; 71 | } 72 | 73 | protected static function findParentPath ($path) 74 | { 75 | $dir = __DIR__; 76 | $previousDir = '.'; 77 | while (! is_dir($dir . '/' . $path)) 78 | { 79 | $dir = dirname($dir); 80 | if ($previousDir === $dir) 81 | return false; 82 | $previousDir = $dir; 83 | } 84 | return $dir . '/' . $path; 85 | } 86 | 87 | public static function getServiceManager () 88 | { 89 | return static::$serviceManager; 90 | } 91 | 92 | public static function getConfig () 93 | { 94 | return static::$config; 95 | } 96 | 97 | protected static function initAutoloader () 98 | { 99 | $vendorPath = static::findParentPath('vendor'); 100 | 101 | if (is_readable($vendorPath . '/autoload.php')) 102 | { 103 | $loader = include $vendorPath . '/autoload.php'; 104 | } 105 | else 106 | { 107 | throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`.'); 108 | } 109 | 110 | AutoloaderFactory::factory(array ( 111 | 'Zend\Loader\StandardAutoloader' => array ( 112 | 'autoregister_zf' => true, 113 | 'namespaces' => array ( 114 | __NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__ 115 | ) 116 | ) 117 | )); 118 | } 119 | } 120 | 121 | Bootstrap::init(); -------------------------------------------------------------------------------- /module/Cornerstone/view/console/application/vhost.tpl: -------------------------------------------------------------------------------- 1 | # Virtual host file for: 2 | # ServerName . PHP_EOL; ?> 3 | # 4 | # Autogenerated by Cornerstone CLI script 5 | # Do not edit this file directly. 6 | # 7 | # @see https://github.com/web-masons/Cornerstone 8 | # @see https://github.com/web-masons/application-skeleton 9 | # 10 | # @author Oakensoul (http://www.oakensoul.com/) 11 | # @link https://github.com/web-masons/Cornerstone for the canonical source repository 12 | # @copyright Copyright (c) 2013, github.com/web-masons Contributors 13 | # @license http://opensource.org/licenses/Apache-2.0 Apache-2.0-Clause 14 | # @package Cornerstone 15 | 16 | Ports as $host ) : ?> 17 | 18 | 19 | 20 | > 21 | ServerName ServerName . PHP_EOL; ?> 22 | Config['Aliases']) && (is_array($this->Config['Aliases']) || $this->Config['Aliases'] instanceof \Zend\Config\Config ) ) : ?> 23 | Config['Aliases'] as $alias ) : ?> 24 | ServerAlias 25 | 26 | 27 | DocumentRoot DocumentRoot . PHP_EOL; ?> 28 | SetEnv APPLICATION_ENV "ApplicationEnv; ?>" 29 | 30 | 31 | SSLEngine on 32 | SSLCertificateFile 33 | SSLCertificateKeyFile 34 | 35 | 36 | 37 | 38 | ModSecRules; ?> 39 | 40 | 41 | 42 | # add MIME encoding for web fonts 43 | AddType application/vnd.ms-fontobject .eot 44 | AddType font/opentype .otf 45 | AddType font/truetype .ttf 46 | AddType application/font-woff .woff 47 | 48 | # dont allow sites to open our pages in a frame - prevents clickjacking security vulnerability 49 | 50 | Header always append X-Frame-Options SAMEORIGIN 51 | 52 | 53 | DocumentRoot;?>> 54 | DirectoryIndex index.php 55 | AllowOverride None 56 | Order Allow,Deny 57 | Allow from all 58 | 59 | RewriteEngine On 60 | 61 | RewritePreRules; ?> 62 | 63 | # The following rule tells Apache that if the requested filename 64 | # exists, simply serve it. 65 | RewriteCond %{REQUEST_FILENAME} -s [OR] 66 | RewriteCond %{REQUEST_FILENAME} -l [OR] 67 | RewriteCond %{REQUEST_FILENAME} -d 68 | RewriteRule ^.*$ - [NC,L] 69 | 70 | Config['StripTrailingSlash']) && $this->Config['StripTrailingSlash'] === true) : ?> 71 | # Remove trailing slash from URL 72 | RewriteRule ^(.+)/$ /$1 [R=301,L] 73 | 74 | 75 | # The following rewrites all other queries to index.php. The 76 | # condition ensures that if you are using Apache aliases to do 77 | # mass virtual hosting, the base path will be prepended to 78 | # allow proper resolution of the index.php file; it will work 79 | # in non-aliased environments as well, providing a safe, one-size 80 | # fits all solution. 81 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ 82 | RewriteRule ^(.*) - [E=BASE:%1] 83 | RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] 84 | 85 | RewritePostRules; ?> 86 | 87 | CorsOrigin ) : ?> 88 | # allow cross origin resource sharing (CORS) 89 | 90 | SetEnvIf Origin "CorsOrigin; ?>" AccessControlAllowOrigin=$0 91 | Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin 92 | 93 | Header set Access-Control-Allow-Credentials "true" 94 | Header set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT" 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /module/Cornerstone/language/Cornerstone_en.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Cornerstone\n" 4 | "POT-Creation-Date: 2013-09-22 21:22-0500\n" 5 | "PO-Revision-Date: 2013-09-22 21:22-0500\n" 6 | "Last-Translator: Robert G. Johnson Jr.\n" 7 | "Language-Team: \n" 8 | "Language: English\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 1.5.7\n" 13 | "X-Poedit-KeywordsList: translate;_;gettext;gettext_noop\n" 14 | "X-Poedit-Basepath: /Users/oakensoul/Sites/Oakensoul/Cornerstone/\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | "X-Poedit-SearchPath-0: module\n" 17 | "X-Poedit-SearchPath-1: public\n" 18 | 19 | #: module/Cornerstone/view/error/404.phtml:3 20 | msgid "A 404 error occurred" 21 | msgstr "" 22 | 23 | #: module/Cornerstone/view/error/404.phtml:12 24 | #: module/Cornerstone/view/error/maintenance.phtml:12 25 | msgid "The requested controller was unable to dispatch the request." 26 | msgstr "" 27 | 28 | #: module/Cornerstone/view/error/404.phtml:15 29 | #: module/Cornerstone/view/error/maintenance.phtml:15 30 | msgid "" 31 | "The requested controller could not be mapped to an existing controller class." 32 | msgstr "" 33 | 34 | #: module/Cornerstone/view/error/404.phtml:18 35 | #: module/Cornerstone/view/error/maintenance.phtml:18 36 | msgid "The requested controller was not dispatchable." 37 | msgstr "" 38 | 39 | #: module/Cornerstone/view/error/404.phtml:21 40 | #: module/Cornerstone/view/error/maintenance.phtml:21 41 | msgid "The requested URL could not be matched by routing." 42 | msgstr "" 43 | 44 | #: module/Cornerstone/view/error/404.phtml:24 45 | #: module/Cornerstone/view/error/maintenance.phtml:24 46 | msgid "We cannot determine at this time why a 404 was generated." 47 | msgstr "" 48 | 49 | #: module/Cornerstone/view/error/404.phtml:36 50 | #: module/Cornerstone/view/error/maintenance.phtml:38 51 | msgid "Controller" 52 | msgstr "" 53 | 54 | #: module/Cornerstone/view/error/404.phtml:43 55 | #: module/Cornerstone/view/error/maintenance.phtml:45 56 | #, php-format 57 | msgid "resolves to %s" 58 | msgstr "" 59 | 60 | #: module/Cornerstone/view/error/404.phtml:55 61 | #: module/Cornerstone/view/error/index.phtml:10 62 | #: module/Cornerstone/view/error/maintenance.phtml:55 63 | msgid "Additional information" 64 | msgstr "" 65 | 66 | #: module/Cornerstone/view/error/404.phtml:58 67 | #: module/Cornerstone/view/error/404.phtml:82 68 | #: module/Cornerstone/view/error/index.phtml:13 69 | #: module/Cornerstone/view/error/index.phtml:37 70 | #: module/Cornerstone/view/error/maintenance.phtml:58 71 | #: module/Cornerstone/view/error/maintenance.phtml:82 72 | msgid "File" 73 | msgstr "" 74 | 75 | #: module/Cornerstone/view/error/404.phtml:62 76 | #: module/Cornerstone/view/error/404.phtml:86 77 | #: module/Cornerstone/view/error/index.phtml:17 78 | #: module/Cornerstone/view/error/index.phtml:41 79 | #: module/Cornerstone/view/error/maintenance.phtml:62 80 | #: module/Cornerstone/view/error/maintenance.phtml:86 81 | msgid "Message" 82 | msgstr "" 83 | 84 | #: module/Cornerstone/view/error/404.phtml:66 85 | #: module/Cornerstone/view/error/404.phtml:90 86 | #: module/Cornerstone/view/error/index.phtml:21 87 | #: module/Cornerstone/view/error/index.phtml:45 88 | #: module/Cornerstone/view/error/maintenance.phtml:66 89 | #: module/Cornerstone/view/error/maintenance.phtml:90 90 | msgid "Stack trace" 91 | msgstr "" 92 | 93 | #: module/Cornerstone/view/error/404.phtml:76 94 | #: module/Cornerstone/view/error/index.phtml:31 95 | #: module/Cornerstone/view/error/maintenance.phtml:76 96 | msgid "Previous exceptions" 97 | msgstr "" 98 | 99 | #: module/Cornerstone/view/error/404.phtml:105 100 | #: module/Cornerstone/view/error/index.phtml:60 101 | #: module/Cornerstone/view/error/maintenance.phtml:105 102 | msgid "No Exception available" 103 | msgstr "" 104 | 105 | #: module/Cornerstone/view/error/index.phtml:3 106 | msgid "An error occurred" 107 | msgstr "" 108 | 109 | #: module/Cornerstone/view/error/maintenance.phtml:3 110 | msgid "The site is currently down for maintenance." 111 | msgstr "" 112 | 113 | #: module/Cornerstone/view/layout/layout.phtml:12 114 | msgid "Cornerstone Module" 115 | msgstr "" 116 | 117 | #: module/Cornerstone/view/layout/layout.phtml:13 118 | msgid "Oakensoul" 119 | msgstr "" 120 | 121 | #: module/Cornerstone/view/layout/partials/site-header.phtml:16 122 | msgid "Home" 123 | msgstr "" 124 | -------------------------------------------------------------------------------- /module/Cornerstone/view/error/404.phtml: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
15 |

translate('A 404 error occurred') ?>

16 |

message ?>

17 | 18 | reason) && $this->reason): ?> 19 | 20 | reason) { 23 | case 'error-controller-cannot-dispatch': 24 | $reasonMessage = $this->translate('The requested controller was unable to dispatch the request.'); 25 | break; 26 | case 'error-controller-not-found': 27 | $reasonMessage = $this->translate('The requested controller could not be mapped to an existing controller class.'); 28 | break; 29 | case 'error-controller-invalid': 30 | $reasonMessage = $this->translate('The requested controller was not dispatchable.'); 31 | break; 32 | case 'error-router-no-match': 33 | $reasonMessage = $this->translate('The requested URL could not be matched by routing.'); 34 | break; 35 | default: 36 | $reasonMessage = $this->translate('We cannot determine at this time why a 404 was generated.'); 37 | break; 38 | } 39 | ?> 40 | 41 |

42 | 43 | 44 | 45 | controller) && $this->controller): ?> 46 | 47 |
48 |
translate('Controller') ?>:
49 |
escapeHtml($this->controller) ?> 50 | controller_class) 52 | && $this->controller_class 53 | && $this->controller_class != $this->controller 54 | ) { 55 | echo '(' . sprintf($this->translate('resolves to %s'), $this->escapeHtml($this->controller_class)) . ')'; 56 | } 57 | ?> 58 |
59 |
60 | 61 | 62 | 63 | display_exceptions) && $this->display_exceptions): ?> 64 | 65 | exception) && $this->exception instanceof Exception): ?> 66 |
67 |

translate('Additional information') ?>:

68 |

exception); ?>

69 |
70 |
translate('File') ?>:
71 |
72 |
exception->getFile() ?>:exception->getLine() ?>
73 |
74 |
translate('Message') ?>:
75 |
76 |
exception->getMessage() ?>
77 |
78 |
translate('Stack trace') ?>:
79 |
80 |
exception->getTraceAsString() ?>
81 |
82 |
83 | exception->getPrevious(); 86 | if ($e) : 87 | ?> 88 |
89 |

translate('Previous exceptions') ?>:

90 |
    91 | 92 |
  • 93 |

    94 |
    95 |
    translate('File') ?>:
    96 |
    97 |
    getFile() ?>:getLine() ?>
    98 |
    99 |
    translate('Message') ?>:
    100 |
    101 |
    getMessage() ?>
    102 |
    103 |
    translate('Stack trace') ?>:
    104 |
    105 |
    getTraceAsString() ?>
    106 |
    107 |
    108 |
  • 109 | getPrevious(); 111 | endwhile; 112 | ?> 113 |
114 | 115 | 116 | 117 | 118 |

translate('No Exception available') ?>

119 | 120 | 121 | 122 | 123 |
124 |
125 | -------------------------------------------------------------------------------- /config/application.config.php: -------------------------------------------------------------------------------- 1 | $stringServiceManagerName, 123 | * 'config_key' => $stringConfigKey, 124 | * 'interface' => $stringOptionalInterface, 125 | * 'method' => $stringRequiredMethodName, 126 | * ), 127 | * 128 | * @var array $service_manager 129 | */ 130 | $application_config['service_manager'] = array (); 131 | 132 | /** 133 | * Initial configuration with which to seed the ServiceManager. 134 | * Should be compatible with Zend\ServiceManager\Config. 135 | * 136 | * @var array $service_listener_options 137 | */ 138 | $application_config['service_listener_options'] = array (); 139 | 140 | return $application_config; 141 | -------------------------------------------------------------------------------- /module/Cornerstone/Module.php: -------------------------------------------------------------------------------- 1 | getApplication(); 25 | $service_manager = $application->getServiceManager(); 26 | $event_manager = $application->getEventManager(); 27 | $shared_manager = $event_manager->getSharedManager(); 28 | 29 | /* allow controller short names in routing */ 30 | $module_route_listener = new ModuleRouteListener(); 31 | $module_route_listener->attach($event_manager); 32 | 33 | /* set sup our localization strategy so that we enforce localization routes */ 34 | $service_manager->get('Http\LocalizationStrategy')->attach($event_manager); 35 | 36 | /* the scheme strategy handles processing based on (http|https) scheme */ 37 | $service_manager->get('Http\SchemeStrategy')->attach($event_manager); 38 | 39 | /* the theme strategy handles setting up basic head scripts and style sheets to the layout */ 40 | $service_manager->get('Http\ThemeStrategy')->attach($event_manager); 41 | 42 | /* the exception logger strategy dumps exception messages to the log before ZF2 gets it and swallows it */ 43 | $service_manager->get('Http\ExceptionLoggerStrategy')->attach($event_manager); 44 | 45 | /* the layout strategy handles overriding the layout for specific routes */ 46 | $service_manager->get('Http\LayoutStrategy')->attach($event_manager); 47 | 48 | /* Cornerstone Application Event Manager */ 49 | $cornerstone_event_manager = $service_manager->get('Application\EventManager'); 50 | 51 | /* attach our CLI strategies */ 52 | $service_manager->get('Console\InitializeApplicationStrategy')->attach($cornerstone_event_manager); 53 | $service_manager->get('Console\BuildVirtualHostStrategy')->attach($cornerstone_event_manager); 54 | $service_manager->get('Console\ApplicationCacheInitStrategy')->attach($cornerstone_event_manager); 55 | $service_manager->get('Console\ApplicationCacheEmptyStrategy')->attach($cornerstone_event_manager); 56 | } 57 | 58 | public function getConfig () 59 | { 60 | return include __DIR__ . '/config/module.config.php'; 61 | } 62 | 63 | public function getAutoloaderConfig () 64 | { 65 | return array ( 66 | 'Zend\Loader\StandardAutoloader' => array ( 67 | 'namespaces' => array ( 68 | __NAMESPACE__ => __DIR__ . '/src/' 69 | ) 70 | ) 71 | ); 72 | } 73 | 74 | public function getConsoleUsage (ConsoleAdapterInterface $console) 75 | { 76 | return array ( 77 | 'Build Commands:', 78 | 'application initialize --env=' => "Initialize the application.", 79 | 'application check-config --env=' => "Check configuration for the application.", 80 | 'application check-integration --env=' => "Check service integrations for the application.", 81 | 'application build-vhost --env=' => 'Generates a vhost file for the project.', 82 | 'application cache-init' => "Initialize the application cache folder.", 83 | 'application cache-empty' => "Empty the application cache folder.", 84 | 85 | 'Optional Parameters:', 86 | array ( 87 | '--force', 88 | 'Force command to go through' 89 | ), 90 | array ( 91 | '--verbose', 92 | 'Verbose output' 93 | ) 94 | ); 95 | } 96 | 97 | public function getServiceConfig () 98 | { 99 | /** 100 | * Factories should be used when you have logic required to create the 101 | * requested service or object. If it's a simple instantiation with no 102 | * dependencies, use an invokable 103 | */ 104 | $factories = array (); 105 | 106 | $factories['translator'] = 'Zend\I18n\Translator\TranslatorServiceFactory'; 107 | $factories['Site\Navigation'] = 'Zend\Navigation\Service\DefaultNavigationFactory'; 108 | 109 | /** 110 | * Invokables should be used for a simple instantiation with no 111 | * dependencies. If you have logic required to create the requested 112 | * service or object, use a factory. 113 | * 114 | * Generally, invokables are great for strategy objects / Listeners 115 | */ 116 | $invokables = array (); 117 | 118 | $invokables['Http\LocalizationStrategy'] = 'Cornerstone\Http\Listener\Localization'; 119 | $invokables['Http\SchemeStrategy'] = 'Cornerstone\Http\Listener\Scheme'; 120 | $invokables['Http\ThemeStrategy'] = 'Cornerstone\Http\Listener\Theme'; 121 | $invokables['Http\ExceptionLoggerStrategy'] = 'Cornerstone\Http\Listener\ExceptionLogger'; 122 | $invokables['Http\LayoutStrategy'] = 'Cornerstone\Http\Listener\Layout'; 123 | 124 | $invokables['Application\EventManager'] = 'Cornerstone\EventManager\Service'; 125 | 126 | $invokables['Console\BuildVirtualHostStrategy'] = 'Cornerstone\Console\Listener\BuildVirtualHost'; 127 | $invokables['Console\ApplicationCacheInitStrategy'] = 'Cornerstone\Console\Listener\ApplicationCacheInit'; 128 | $invokables['Console\ApplicationCacheEmptyStrategy'] = 'Cornerstone\Console\Listener\ApplicationCacheEmpty'; 129 | $invokables['Console\InitializeApplicationStrategy'] = 'Cornerstone\Console\Listener\InitializeApplication'; 130 | 131 | $service_config = array ( 132 | 'factories' => $factories, 133 | 'invokables' => $invokables 134 | ); 135 | 136 | return $service_config; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Console/Listener/ApplicationCacheInit.php: -------------------------------------------------------------------------------- 1 | listeners[] = $pEventManager->attach(Service::EVENT_APPLICATION_INITIALIZE, $options, 10); 35 | $this->listeners[] = $pEventManager->attach(Service::EVENT_APPLICATION_CACHE_INIT, $options, 1); 36 | } 37 | 38 | public function EventHandler (Console\Event $pEvent) 39 | { 40 | try 41 | { 42 | $console = $this->getServiceLocator()->get('console'); 43 | 44 | $config = $this->getServiceLocator()->get('ApplicationConfig'); 45 | 46 | if (true == $pEvent->getVerboseFlag()) 47 | { 48 | $console->write(' --------------- ', ColorInterface::LIGHT_GREEN); 49 | $console->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 50 | 51 | $console->write(" [Listener] ", ColorInterface::LIGHT_GREEN); 52 | $console->writeLine(__CLASS__, ColorInterface::YELLOW); 53 | 54 | $console->write(' --------------- ', ColorInterface::LIGHT_GREEN); 55 | $console->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 56 | } 57 | 58 | if (false === array_key_exists('module_listener_options', $config)) 59 | { 60 | if (true == $pEvent->getVerboseFlag()) 61 | { 62 | $console->write(" [NOTICE] ", ColorInterface::LIGHT_CYAN); 63 | $console->writeLine("Application config does not contain an entry for 'module_listener_options'.", ColorInterface::CYAN); 64 | $console->write(" ", ColorInterface::LIGHT_CYAN); 65 | $console->writeLine("Skipping creation of application cache folder." . PHP_EOL, ColorInterface::CYAN); 66 | } 67 | 68 | return NULL; 69 | } 70 | 71 | if (false === array_key_exists('cache_dir', $config['module_listener_options'])) 72 | { 73 | if (true == $pEvent->getVerboseFlag()) 74 | { 75 | $console->write(" [Failure] ", ColorInterface::RED); 76 | $console->writeLine('Application config error, module_listener_options, does not contain a "cache_dir" entry!' . PHP_EOL, ColorInterface::RED); 77 | } 78 | 79 | throw new Exception('Application config error, module_listener_options, does not contain a "cache_dir" entry!'); 80 | } 81 | 82 | $cache_dir = $config['module_listener_options']['cache_dir']; 83 | 84 | if (true == $pEvent->getVerboseFlag()) 85 | { 86 | $console->write(" [Cache Dir] "); 87 | $console->writeLine($cache_dir, ColorInterface::YELLOW); 88 | } 89 | 90 | if (false === is_dir($cache_dir)) 91 | { 92 | $result = mkdir($cache_dir, 0775, true); 93 | 94 | if (true === $result) 95 | { 96 | if (true == $pEvent->getVerboseFlag()) 97 | { 98 | $console->write(" [NOTICE] ", ColorInterface::LIGHT_CYAN); 99 | $console->writeLine("Cache directory has been created.", ColorInterface::CYAN); 100 | } 101 | } 102 | else 103 | { 104 | if (true == $pEvent->getVerboseFlag()) 105 | { 106 | $console->write(" [Failure] ", ColorInterface::RED); 107 | $console->writeLine('Failed to create cache directory, ' . $cache_dir . PHP_EOL, ColorInterface::RED); 108 | } 109 | 110 | throw new Exception('Failed to create cache directory, ' . $cache_dir); 111 | } 112 | } 113 | 114 | if (false === is_writable($cache_dir)) 115 | { 116 | if (true == $pEvent->getVerboseFlag()) 117 | { 118 | $console->write(" [Failure] ", ColorInterface::RED); 119 | $console->writeLine("Cache directory ($cache_dir) is not writable by web server." . PHP_EOL, ColorInterface::RED); 120 | } 121 | 122 | throw new Exception("Cache directory ($cache_dir) is not writable by web server."); 123 | } 124 | 125 | if (true == $pEvent->getVerboseFlag()) 126 | { 127 | $console->write(" [Success] ", ColorInterface::GREEN); 128 | $console->writeLine("Application cache folder ($cache_dir) exists and is writable." . PHP_EOL); 129 | } 130 | 131 | return NULL; 132 | } 133 | catch (Exception $e) 134 | { 135 | $response = new Response(); 136 | $response->setErrorLevel(1); 137 | $response->setContent('Exception Encountered: ' . $e->getMessage()); 138 | return $response; 139 | } 140 | } 141 | 142 | /** 143 | * Set service locator 144 | * 145 | * @param ServiceManager\ServiceLocatorInterface $serviceLocator 146 | */ 147 | public function setServiceLocator (ServiceManager\ServiceLocatorInterface $serviceLocator) 148 | { 149 | $this->mServiceLocator = $serviceLocator; 150 | } 151 | 152 | /** 153 | * Get service locator 154 | * 155 | * @return ServiceManager\ServiceLocatorInterface 156 | */ 157 | public function getServiceLocator () 158 | { 159 | return $this->mServiceLocator; 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Console/Listener/ApplicationCacheEmpty.php: -------------------------------------------------------------------------------- 1 | listeners[] = $pEventManager->attach(Service::EVENT_APPLICATION_CACHE_EMPTY, $options, 1); 38 | } 39 | 40 | public function EventHandler (Console\Event $pEvent) 41 | { 42 | try 43 | { 44 | $console = $this->getServiceLocator()->get('console'); 45 | 46 | $config = $this->getServiceLocator()->get('ApplicationConfig'); 47 | 48 | if (true == $pEvent->getVerboseFlag()) 49 | { 50 | $console->write(' --------------- ', ColorInterface::LIGHT_GREEN); 51 | $console->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 52 | 53 | $console->write(" [Listener] ", ColorInterface::LIGHT_GREEN); 54 | $console->writeLine(__CLASS__, ColorInterface::YELLOW); 55 | 56 | $console->write(' --------------- ', ColorInterface::LIGHT_GREEN); 57 | $console->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 58 | } 59 | 60 | if (false === array_key_exists('module_listener_options', $config)) 61 | { 62 | if (true == $pEvent->getVerboseFlag()) 63 | { 64 | $console->write(" [Failure] ", ColorInterface::RED); 65 | $console->writeLine("Application config does not contain an entry for 'module_listener_options'.", ColorInterface::RED); 66 | $console->write(" ", ColorInterface::LIGHT_CYAN); 67 | $console->writeLine("Skipping emptying of application cache folder." . PHP_EOL, ColorInterface::CYAN); 68 | } 69 | 70 | throw new Exception('Application config error, module_listener_options, does not exist. Directory empty failed!'); 71 | } 72 | 73 | if (false === array_key_exists('cache_dir', $config['module_listener_options'])) 74 | { 75 | if (true == $pEvent->getVerboseFlag()) 76 | { 77 | $console->write(" [Failure] ", ColorInterface::RED); 78 | $console->writeLine('Application config error, module_listener_options, does not contain a "cache_dir" entry!' . PHP_EOL, ColorInterface::RED); 79 | } 80 | 81 | throw new Exception('Application config error, module_listener_options, does not contain a "cache_dir" entry!'); 82 | } 83 | 84 | $cache_dir = $config['module_listener_options']['cache_dir']; 85 | 86 | if (true == $pEvent->getVerboseFlag()) 87 | { 88 | $console->write(" [Cache Dir] "); 89 | $console->writeLine($cache_dir, ColorInterface::YELLOW); 90 | } 91 | 92 | 93 | if (false === is_writable($cache_dir)) 94 | { 95 | if (true == $pEvent->getVerboseFlag()) 96 | { 97 | $console->write(" [Failure] ", ColorInterface::RED); 98 | $console->writeLine("Cache directory ($cache_dir) is not writable by web server." . PHP_EOL, ColorInterface::RED); 99 | } 100 | 101 | throw new Exception("Cache directory ($cache_dir) is not writable by web server."); 102 | } 103 | 104 | if (true == $pEvent->getVerboseFlag()) 105 | { 106 | $console->write(" [NOTICE] ", ColorInterface::LIGHT_CYAN); 107 | $console->writeLine("Emptying cache directory of any existing files/folders.", ColorInterface::CYAN); 108 | } 109 | 110 | $iterator = new RecursiveDirectoryIterator($cache_dir, FilesystemIterator::SKIP_DOTS); 111 | 112 | foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $path) 113 | { 114 | /* @var RecursiveDirectoryIterator $path */ 115 | if (true == $pEvent->getVerboseFlag()) 116 | { 117 | $console->write(" [NOTICE] ", ColorInterface::LIGHT_CYAN); 118 | $console->writeLine("Deleting " . $path->getPathname(), ColorInterface::CYAN); 119 | } 120 | 121 | $path->isFile() ? unlink($path->getPathname()) : rmdir($path->getPathname()); 122 | } 123 | 124 | if (true == $pEvent->getVerboseFlag()) 125 | { 126 | $console->write(" [Success] ", ColorInterface::GREEN); 127 | $console->writeLine("Application cache folder ($cache_dir) has been emptied." . PHP_EOL); 128 | } 129 | 130 | return NULL; 131 | } 132 | catch (Exception $e) 133 | { 134 | $response = new Response(); 135 | $response->setErrorLevel(1); 136 | $response->setContent('Exception Encountered: ' . $e->getMessage()); 137 | return $response; 138 | } 139 | } 140 | 141 | /** 142 | * Set service locator 143 | * 144 | * @param ServiceManager\ServiceLocatorInterface $serviceLocator 145 | */ 146 | public function setServiceLocator (ServiceManager\ServiceLocatorInterface $serviceLocator) 147 | { 148 | $this->mServiceLocator = $serviceLocator; 149 | } 150 | 151 | /** 152 | * Get service locator 153 | * 154 | * @return ServiceManager\ServiceLocatorInterface 155 | */ 156 | public function getServiceLocator () 157 | { 158 | return $this->mServiceLocator; 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Console/Controller/ApplicationController.php: -------------------------------------------------------------------------------- 1 | RequireConsoleRequest(); 56 | 57 | $this->mConsole = $this->getServiceLocator()->get('console'); 58 | $this->mForce = $this->params('force', false); 59 | $this->mEvent = $this->params('event', false); 60 | $this->mVerbose = $this->params('verbose', false); 61 | $this->mEnvironment = $this->params()->fromRoute('env', $this->mEnvironment); 62 | 63 | /** 64 | * Output the standard Console Flag for verbose output 65 | */ 66 | if (true == $this->mVerbose) 67 | { 68 | $this->mConsole->clearScreen(); 69 | 70 | $this->mConsole->write(" [Controller] ", ColorInterface::LIGHT_GREEN); 71 | $this->mConsole->writeLine(__CLASS__, ColorInterface::YELLOW); 72 | 73 | $this->mConsole->write(" [Action] ", ColorInterface::LIGHT_GREEN); 74 | $this->mConsole->writeLine(__FUNCTION__, ColorInterface::YELLOW); 75 | 76 | $this->mConsole->write(" [Verbose] ", ColorInterface::LIGHT_GREEN); 77 | $this->mConsole->writeLine('true', ColorInterface::YELLOW); 78 | 79 | $this->mConsole->write(" [Force] ", ColorInterface::LIGHT_GREEN); 80 | $this->mConsole->writeLine(true === $this->mForce ? 'true' : 'false', ColorInterface::YELLOW); 81 | 82 | $this->mConsole->write(" [Event Manager] ", ColorInterface::LIGHT_GREEN); 83 | $this->mConsole->writeLine('Cornerstone\EventManager\Service', ColorInterface::YELLOW); 84 | 85 | $this->mConsole->write(" [Trigger] ", ColorInterface::LIGHT_GREEN); 86 | $this->mConsole->writeLine($this->mEvent, ColorInterface::YELLOW); 87 | $this->mConsole->writeLine(); 88 | } 89 | 90 | $event = new EventManager\Console\Event(); 91 | $event->setName($this->mEvent); 92 | $event->setTarget($this); 93 | $event->setForceFlag($this->mForce); 94 | $event->setVerboseFlag($this->mVerbose); 95 | $event->setEnvironment($this->mEnvironment); 96 | 97 | $event_result = $this->EventManager()->trigger($event); 98 | 99 | $response = new Response(); 100 | $response->setErrorLevel(0); 101 | 102 | foreach ($event_result as $result) 103 | { 104 | if (is_object($result)) 105 | { 106 | /* @var Response $result */ 107 | if (0 < $result->getErrorLevel()) 108 | { 109 | $this->mConsole->write("[Error] ", ColorInterface::RED); 110 | 111 | /* we have to use error log here so that it will write to stderr instead of stdout */ 112 | error_log($result->getContent()); 113 | 114 | $error_level = $result->getErrorLevel() + $response->getErrorLevel(); 115 | $response->setErrorLevel($error_level); 116 | } 117 | else 118 | { 119 | $this->mConsole->writeLine($result->getContent()); 120 | } 121 | } 122 | } 123 | 124 | if (true == $this->mVerbose && 0 == $response->getErrorLevel()) 125 | { 126 | $this->mConsole->write(' --------------- ', ColorInterface::LIGHT_GREEN); 127 | $this->mConsole->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 128 | 129 | $this->mConsole->write(" [Completed] ", ColorInterface::LIGHT_GREEN); 130 | $this->mConsole->writeLine("Event processing", ColorInterface::YELLOW); 131 | } 132 | 133 | return $response; 134 | } 135 | 136 | /** 137 | * RequireConsoleRequest 138 | * 139 | * This method makes sure that we're in a console request, if we're not, it will 140 | * throw a RuntimeException. Technically Zend automatically protects against this 141 | * unless, but I've added it so that a route doesn't accidentally get added and 142 | * expose it. 143 | * 144 | * @throws \RuntimeException 145 | */ 146 | protected function RequireConsoleRequest () 147 | { 148 | $request = $this->getRequest(); 149 | 150 | // Make sure that we are running in a console and that we have not somehow 151 | // accidentally exposed this route to http traffic 152 | if (! $request instanceof Console\Request) 153 | { 154 | throw new \RuntimeException('You can only use this action from a console!'); 155 | } 156 | } 157 | 158 | /** 159 | * Returns the Cornerstone Event Manger Service for logging functionality 160 | * 161 | * @return EventManager\Service 162 | */ 163 | protected function EventManager () 164 | { 165 | if (empty($this->mEventManager)) 166 | { 167 | $this->mEventManager = $this->getServiceLocator()->get('Application\EventManager'); 168 | $this->mEventManager->setEventClass('Zend\Mvc\MvcEvent'); 169 | } 170 | 171 | return $this->mEventManager; 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /doc/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | So, you want to contribute to the Cornerstone project? Welcome! This project is 3 | used for a number of applications, so please read through the following 4 | documentation to get acquainted with the project. 5 | 6 | ## The Vision 7 | Before you can contribute to the project, it's best to understand what the project 8 | is trying to accomplish and what it is not. 9 | 10 | For those of us who love to write software, we often will start from a common 11 | collection of code modules. For those of you reading this, that is likely the ZF2 12 | Framework. If you have worked with ZF2 at all, you will know that there is already 13 | a great skeleton application provided by the ZF2 community. That skeleton application 14 | comes with a full set of files to start your own site. However, it is sparse 15 | and allows you to derive your own implementation (and rightfully so!). 16 | It gives you everything you need to pave your own way. 17 | 18 | Cornerstone (and its partner [skeleton-application](https://github.com/oakensoul/application-skeleton) 19 | is a replacement (or feature extension really) for community skeleton-app. 20 | It provides a few pre-paved roads for you to build on because it's not meant for 21 | everyone out there, just the folks that like what it does and want to use it. 22 | 23 | The primary drive for Cornerstone is to provide a more formal implementation and 24 | collection of systems for beginning new site or module development. You will notice 25 | that Cornerstone itself is both a ZF2 Module and also a site in its own right. When used 26 | as a Module, only the module pieces will be engaged, but when developing the module itself 27 | you have the full MVC at your fingertips so you can develop and test in relative isolation. 28 | 29 | Cornerstone is meant to provide additional utilitarian features and functionality, 30 | most of which should be configurable so that you can choose what features you wish 31 | to take advantage of. 32 | 33 | The project is attempting to walk a fine line between making a lot of best practices 34 | easier for you while not telling you what to do and how to do it. If it's not your 35 | cup of tea, no hard feelings! Though feedback and constructive criticism is always 36 | welcome! 37 | 38 | ## The Basics 39 | This project uses the "GitHub" branching model. If you'd like to read more on 40 | some of the various branching models, the two big Elephpants in the room are 41 | the [GitHub Flow](http://scottchacon.com/2011/08/31/github-flow.html) and the 42 | [Gitflow](http://nvie.com/posts/a-successful-git-branching-model/) branching model. 43 | 44 | ## Running Tests 45 | The most important part of changes are their tests. Every new feature or issue 46 | being fixed should have a matching test. This project uses PHPUnit, CasperJS 47 | and Phantom. 48 | 49 | ### PHPUnit Tests 50 | * Make sure you have PHPUnit installed with an updated version 51 | * PHPUnit tests will be located in `test/phpunit/` 52 | 53 | ### CasperJS Tests 54 | * Make sure you have CasperJS and Phantom installed with updated versions 55 | * CasperJS tests will be located in `test/casperjs/` 56 | 57 | ## Bug Reports 58 | When the inevitable happens and you discover a bug in the documentation or the 59 | code, please follow the process below to help us out. 60 | 61 | * Search the existing issues to see if the issue has already been filed 62 | * Make sure the issue is a bug and not simply a preference 63 | * If you've found a new issue, please then file it 64 | 65 | From that point, if you're interest in contributing some code, ask in the issue 66 | if we're willing to accept a failing test case, and/or a fix. If we are, then 67 | follow the steps for contributing and we can go from there! 68 | 69 | ## Feature Requests 70 | With a module like Cornerstone, every new feature request should be scrutinized 71 | to make sure we're not going to experience feature bloat. Every new feature should 72 | fit the Vision for the project. If you've got an idea for a new feature and you 73 | feel it fits the vision, file an issue and we can discuss it. 74 | 75 | Make sure any feature request you make fits the 76 | [INVEST](http://en.wikipedia.org/wiki/INVEST_(mnemonic) mnemonic. 77 | 78 | ## Pull Requests 79 | A well written pull request is a huge piece of the success of any open source project. 80 | Please make sure to take the time to think out the request and document/comment well. 81 | A good pull request should be the smallest successful feature, akin to the 82 | [INVEST](http://en.wikipedia.org/wiki/INVEST_(mnemonic) mnemonic used in scrum. 83 | 84 | Make sure if you're not a project member and just getting started that you have a 85 | related issue for your Pull Request and that a project owner approves the work 86 | before putting the effort in to make the change. Most of the time as long as you're 87 | following the project vision, we'll welcome additions, but it's better to be save 88 | than sorry. 89 | 90 | Also, make sure your pull request is built with a compilation of great 91 | [commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 92 | 93 | The [Bower](https://github.com/bower/bower/blob/master/CONTRIBUTING.md) project has 94 | awesome instructions for Pull Requests, I've added a copy here. 95 | 96 | Adhering to the following this process is the best way to get your work 97 | included in the project: 98 | 99 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 100 | and configure the remotes: 101 | 102 | ```bash 103 | # Clone your fork of the repo into the current directory 104 | git clone https://github.com//Cornerstone 105 | # Navigate to the newly cloned directory 106 | cd Cornerstone 107 | # Assign the original repo to a remote called "upstream" 108 | git remote add upstream https://github.com/web-masons/Cornerstone 109 | ``` 110 | 111 | 2. If you cloned a while ago, get the latest changes from upstream: 112 | 113 | ```bash 114 | git checkout master 115 | git pull upstream master 116 | ``` 117 | 118 | 3. Create a new topic branch (off the main project development branch) to 119 | contain your feature, change, or fix: 120 | 121 | ```bash 122 | git checkout -b 123 | ``` 124 | 125 | 4. Make sure to update, or add to the tests when appropriate. Patches and 126 | features will not be accepted without tests. Run `phpunit` and `casper` 127 | tests as relevant to make sure all tests pass after you've made changes. 128 | 129 | 5. Commit your changes in logical chunks. Please adhere to these [git commit 130 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 131 | or your code is unlikely be merged into the main project. Use Git's 132 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 133 | feature to tidy up your commits before making them public. 134 | 135 | 6. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 7. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description. 149 | 150 | 9. If you are asked to amend your changes before they can be merged in, please 151 | use `git commit --amend` (or rebasing for multi-commit Pull Requests) and 152 | force push to your remote feature branch. You may also be asked to squash 153 | commits. 154 | 155 | **IMPORTANT**: By submitting a patch, you agree to license your work under the 156 | same license as that used by the project. 157 | -------------------------------------------------------------------------------- /module/Cornerstone/config/module.config.php: -------------------------------------------------------------------------------- 1 | array( 27 | 'home' => array( 28 | 'type' => 'Segment', 29 | 'may_terminate' => true, 30 | 'options' => array( 31 | 'route' => '[/:lang][/]', 32 | 'defaults' => array( 33 | 'controller' => 'Application\Controller\Index', 34 | 'action' => 'index', 35 | 'force_localized_route' => false, 36 | 'force_https_scheme' => false, 37 | 'theme' => 'default', 38 | 'layout'=> 'layout/layout' 39 | ), 40 | 'constraints' => array( 41 | 'lang' => '(en|fr|it|de|es)' 42 | ) 43 | ), 44 | 'child_routes' => array( 45 | 'not-found' => array( 46 | 'type' => 'Segment', 47 | 'priority' => 9001, 48 | 'may_terminate' => true, 49 | 'options' => array( 50 | 'route' => 'not-found[/]', 51 | 'defaults' => array( 52 | 'controller' => 'Application\Controller\NotFound', 53 | 'action' => 'index', 54 | 'force_localized_route' => false, 55 | 'force_https_scheme' => false 56 | ) 57 | ) 58 | ), 59 | 'system-error' => array( 60 | 'type' => 'Segment', 61 | 'priority' => 9002, 62 | 'may_terminate' => true, 63 | 'options' => array( 64 | 'route' => 'system-error[/]', 65 | 'defaults' => array( 66 | 'controller' => 'Application\Controller\Exception', 67 | 'action' => 'index', 68 | 'force_localized_route' => false, 69 | 'force_https_scheme' => false 70 | ) 71 | ) 72 | ) 73 | ) 74 | ) 75 | ) 76 | ); 77 | 78 | /** 79 | * To add a new controller... 80 | * 81 | * http://framework.zend.com/manual/2.2/en/user-guide/routing-and-controllers.html 82 | */ 83 | $controllers = array( 84 | 'invokables' => array( 85 | 'Application\Controller\Index' => 'Cornerstone\Http\Controller\IndexController', 86 | 'Application\Controller\NotFound' => 'Cornerstone\Http\Controller\NotFoundController', 87 | 'Application\Controller\Exception' => 'Cornerstone\Http\Controller\ExceptionController', 88 | 'Console\Controller\Application' => 'Cornerstone\Console\Controller\ApplicationController' 89 | ) 90 | ); 91 | 92 | /** 93 | * Controller Plugins 94 | * 95 | * http://lab.empirio.no/custom-controller-plugin-in-zf2.html 96 | */ 97 | $controller_plugins = array( 98 | 'invokables' => array( 99 | ) 100 | ); 101 | 102 | /** 103 | * Working with Views 104 | * 105 | * http://framework.zend.com/manual/2.2/en/modules/zend.view.quick-start.html 106 | */ 107 | $view_manager = array( 108 | 'display_not_found_reason' => false, 109 | 'display_exceptions' => false, 110 | 'doctype' => 'HTML5', 111 | 'not_found_template' => 'error/404', 112 | 'exception_template' => 'error/index', 113 | 'template_map' => array( 114 | 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 115 | 'layout/navigation' => __DIR__ . '/../view/layout/partials/site/navigation.phtml', 116 | 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', 117 | 'error/404' => __DIR__ . '/../view/error/404.phtml', 118 | 'error/index' => __DIR__ . '/../view/error/index.phtml', 119 | 'application/vhost' => __DIR__ . '/../view/console/application/vhost.tpl', 120 | 'application/vhost/rewrite/rules/pre' => __DIR__ . '/../view/console/application/partials/rewrite-pre-rules.phtml', 121 | 'application/vhost/rewrite/rules/post' => __DIR__ . '/../view/console/application/partials/rewrite-post-rules.phtml', 122 | 'application/vhost/modsec' => __DIR__ . '/../view/console/application/partials/modsec-rules.phtml', 123 | ), 124 | 'template_path_stack' => array( 125 | __DIR__ . '/../view' 126 | ) 127 | ); 128 | 129 | $console = array( 130 | 'router' => array( 131 | 'routes' => array( 132 | 'cli-build-vhost' => array( 133 | 'options' => array( 134 | 'route' => 'application build-vhost --env= [--force] [--verbose]', 135 | 'defaults' => array( 136 | 'controller' => 'Console\Controller\Application', 137 | 'action' => 'event', 138 | 'event' => Cornerstone\EventManager\Service::EVENT_APPLICATION_BUILD_VHOST, 139 | 'installer-route' => true 140 | ) 141 | ) 142 | ), 143 | 'cli-application-cache-init' => array( 144 | 'options' => array( 145 | 'route' => 'application cache-init [--verbose]', 146 | 'defaults' => array( 147 | 'controller' => 'Console\Controller\Application', 148 | 'action' => 'event', 149 | 'event' => Cornerstone\EventManager\Service::EVENT_APPLICATION_CACHE_INIT, 150 | 'installer-route' => true 151 | ) 152 | ) 153 | ), 154 | 'cli-application-cache-empty' => array( 155 | 'options' => array( 156 | 'route' => 'application cache-empty [--verbose]', 157 | 'defaults' => array( 158 | 'controller' => 'Console\Controller\Application', 159 | 'action' => 'event', 160 | 'event' => Cornerstone\EventManager\Service::EVENT_APPLICATION_CACHE_EMPTY, 161 | 'installer-route' => true 162 | ) 163 | ) 164 | ), 165 | 'application-initialization' => array( 166 | 'options' => array( 167 | 'route' => 'application initialize --env= [--force] [--verbose]', 168 | 'defaults' => array( 169 | 'controller' => 'Console\Controller\Application', 170 | 'action' => 'event', 171 | 'event' => Cornerstone\EventManager\Service::EVENT_APPLICATION_INITIALIZE, 172 | 'installer-route' => true 173 | ) 174 | ) 175 | ), 176 | 177 | 'application-configuration-check' => array( 178 | 'options' => array( 179 | 'route' => 'application check-config --env= [--force] [--verbose]', 180 | 'defaults' => array( 181 | 'controller' => 'Console\Controller\Application', 182 | 'action' => 'event', 183 | 'event' => Cornerstone\EventManager\Service::EVENT_APPLICATION_CHECK_CONFIGURATION, 184 | 'installer-route' => true 185 | ) 186 | ) 187 | ), 188 | 189 | 'application-integration-check' => array( 190 | 'options' => array( 191 | 'route' => 'application check-integration --env= [--force] [--verbose]', 192 | 'defaults' => array( 193 | 'controller' => 'Console\Controller\Application', 194 | 'action' => 'event', 195 | 'event' => Cornerstone\EventManager\Service::EVENT_APPLICATION_CHECK_INTEGRATION, 196 | 'installer-route' => true 197 | ) 198 | ) 199 | ) 200 | ) 201 | ) 202 | ); 203 | 204 | $translator = array( 205 | 'translation_file_patterns' => array( 206 | array( 207 | 'type' => 'gettext', 208 | 'base_dir' => realpath(__DIR__ . '/../language'), 209 | 'pattern' => 'Cornerstone_%s.mo' 210 | ) 211 | ) 212 | ); 213 | 214 | $navigation = array( 215 | 'default' => array( 216 | 'Application' => array( 217 | 'label' => 'Home', 218 | 'route' => 'home', 219 | 'order' => 1 220 | ) 221 | ) 222 | ); 223 | 224 | $installation = array(); 225 | 226 | $installation['Vhost'] = array ( 227 | 'ApacheLog' => '${APACHE_LOG_DIR}', 228 | 'UseSysLog' => true 229 | ); 230 | 231 | $installation['Vhost']['Server'] = array( 232 | 'Domain' => 'cornerstone', 233 | 'Prefix' => '', 234 | 'Suffix' => '.com', 235 | 'Region' => 'www.', 236 | 'Extension' => 'vhost', 237 | 'PublicFolder' => 'public/', 238 | 'Path' => '/etc/apache2/sites-available/' 239 | ); 240 | 241 | /** 242 | * Set up to use ubuntu self-signed certs by default, 243 | * set up your real certs in your global, local or 244 | * environment configs 245 | */ 246 | $installation['Vhost']['Ports'] = array( 247 | 'port-80' => array( 248 | 'Port' => 80, 249 | 'Scheme' => 'http' 250 | ), 251 | 'port-443' => array( 252 | 'Port' => 443, 253 | 'Scheme' => 'https', 254 | 'SSLCert' => '/etc/ssl/certs/ssl-cert-snakeoil.pem', 255 | 'SSLKey' => '/etc/ssl/private/ssl-cert-snakeoil.key' 256 | ) 257 | ); 258 | 259 | $view_helpers = array( 260 | 'invokables' => array( 261 | 'ChangeLocale' => 'Cornerstone\Http\ViewHelper\ChangeLocale' 262 | ) 263 | ); 264 | 265 | $cornerstone = array( 266 | 'Application' => array( 267 | 'Log' => array( 268 | 'Event' => array( 269 | 'Facility' => NULL, 270 | 'ApplicationName' => NULL 271 | ), 272 | 'General' => array( 273 | 'Facility' => NULL, 274 | 'ApplicationName' => NULL 275 | ) 276 | ) 277 | ) 278 | ); 279 | 280 | $config = array(); 281 | $config['router'] = $router; 282 | $config['console'] = $console; 283 | $config['translator'] = $translator; 284 | $config['controllers'] = $controllers; 285 | $config['controller_plugins'] = $controller_plugins; 286 | $config['navigation'] = $navigation; 287 | $config['view_manager'] = $view_manager; 288 | $config['view_helpers'] = $view_helpers; 289 | $config['Installation'] = $installation; 290 | $config['Cornerstone'] = $cornerstone; 291 | 292 | return $config; 293 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Robert G. Johnson Jr. @Oakensoul and Project Contributors listed in README.md 2 | 3 | Apache License 4 | Version 2.0, January 2004 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, 12 | and distribution as defined by Sections 1 through 9 of this document. 13 | 14 | "Licensor" shall mean the copyright owner or entity authorized by 15 | the copyright owner that is granting the License. 16 | 17 | "Legal Entity" shall mean the union of the acting entity and all 18 | other entities that control, are controlled by, or are under common 19 | control with that entity. For the purposes of this definition, 20 | "control" means (i) the power, direct or indirect, to cause the 21 | direction or management of such entity, whether by contract or 22 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 23 | outstanding shares, or (iii) beneficial ownership of such entity. 24 | 25 | "You" (or "Your") shall mean an individual or Legal Entity 26 | exercising permissions granted by this License. 27 | 28 | "Source" form shall mean the preferred form for making modifications, 29 | including but not limited to software source code, documentation 30 | source, and configuration files. 31 | 32 | "Object" form shall mean any form resulting from mechanical 33 | transformation or translation of a Source form, including but 34 | not limited to compiled object code, generated documentation, 35 | and conversions to other media types. 36 | 37 | "Work" shall mean the work of authorship, whether in Source or 38 | Object form, made available under the License, as indicated by a 39 | copyright notice that is included in or attached to the work 40 | (an example is provided in the Appendix below). 41 | 42 | "Derivative Works" shall mean any work, whether in Source or Object 43 | form, that is based on (or derived from) the Work and for which the 44 | editorial revisions, annotations, elaborations, or other modifications 45 | represent, as a whole, an original work of authorship. For the purposes 46 | of this License, Derivative Works shall not include works that remain 47 | separable from, or merely link (or bind by name) to the interfaces of, 48 | the Work and Derivative Works thereof. 49 | 50 | "Contribution" shall mean any work of authorship, including 51 | the original version of the Work and any modifications or additions 52 | to that Work or Derivative Works thereof, that is intentionally 53 | submitted to Licensor for inclusion in the Work by the copyright owner 54 | or by an individual or Legal Entity authorized to submit on behalf of 55 | the copyright owner. For the purposes of this definition, "submitted" 56 | means any form of electronic, verbal, or written communication sent 57 | to the Licensor or its representatives, including but not limited to 58 | communication on electronic mailing lists, source code control systems, 59 | and issue tracking systems that are managed by, or on behalf of, the 60 | Licensor for the purpose of discussing and improving the Work, but 61 | excluding communication that is conspicuously marked or otherwise 62 | designated in writing by the copyright owner as "Not a Contribution." 63 | 64 | "Contributor" shall mean Licensor and any individual or Legal Entity 65 | on behalf of whom a Contribution has been received by Licensor and 66 | subsequently incorporated within the Work. 67 | 68 | 2. Grant of Copyright License. Subject to the terms and conditions of 69 | this License, each Contributor hereby grants to You a perpetual, 70 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 71 | copyright license to reproduce, prepare Derivative Works of, 72 | publicly display, publicly perform, sublicense, and distribute the 73 | Work and such Derivative Works in Source or Object form. 74 | 75 | 3. Grant of Patent License. Subject to the terms and conditions of 76 | this License, each Contributor hereby grants to You a perpetual, 77 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 78 | (except as stated in this section) patent license to make, have made, 79 | use, offer to sell, sell, import, and otherwise transfer the Work, 80 | where such license applies only to those patent claims licensable 81 | by such Contributor that are necessarily infringed by their 82 | Contribution(s) alone or by combination of their Contribution(s) 83 | with the Work to which such Contribution(s) was submitted. If You 84 | institute patent litigation against any entity (including a 85 | cross-claim or counterclaim in a lawsuit) alleging that the Work 86 | or a Contribution incorporated within the Work constitutes direct 87 | or contributory patent infringement, then any patent licenses 88 | granted to You under this License for that Work shall terminate 89 | as of the date such litigation is filed. 90 | 91 | 4. Redistribution. You may reproduce and distribute copies of the 92 | Work or Derivative Works thereof in any medium, with or without 93 | modifications, and in Source or Object form, provided that You 94 | meet the following conditions: 95 | 96 | (a) You must give any other recipients of the Work or 97 | Derivative Works a copy of this License; and 98 | 99 | (b) You must cause any modified files to carry prominent notices 100 | stating that You changed the files; and 101 | 102 | (c) You must retain, in the Source form of any Derivative Works 103 | that You distribute, all copyright, patent, trademark, and 104 | attribution notices from the Source form of the Work, 105 | excluding those notices that do not pertain to any part of 106 | the Derivative Works; and 107 | 108 | (d) If the Work includes a "NOTICE" text file as part of its 109 | distribution, then any Derivative Works that You distribute must 110 | include a readable copy of the attribution notices contained 111 | within such NOTICE file, excluding those notices that do not 112 | pertain to any part of the Derivative Works, in at least one 113 | of the following places: within a NOTICE text file distributed 114 | as part of the Derivative Works; within the Source form or 115 | documentation, if provided along with the Derivative Works; or, 116 | within a display generated by the Derivative Works, if and 117 | wherever such third-party notices normally appear. The contents 118 | of the NOTICE file are for informational purposes only and 119 | do not modify the License. You may add Your own attribution 120 | notices within Derivative Works that You distribute, alongside 121 | or as an addendum to the NOTICE text from the Work, provided 122 | that such additional attribution notices cannot be construed 123 | as modifying the License. 124 | 125 | You may add Your own copyright statement to Your modifications and 126 | may provide additional or different license terms and conditions 127 | for use, reproduction, or distribution of Your modifications, or 128 | for any such Derivative Works as a whole, provided Your use, 129 | reproduction, and distribution of the Work otherwise complies with 130 | the conditions stated in this License. 131 | 132 | 5. Submission of Contributions. Unless You explicitly state otherwise, 133 | any Contribution intentionally submitted for inclusion in the Work 134 | by You to the Licensor shall be under the terms and conditions of 135 | this License, without any additional terms or conditions. 136 | Notwithstanding the above, nothing herein shall supersede or modify 137 | the terms of any separate license agreement you may have executed 138 | with Licensor regarding such Contributions. 139 | 140 | 6. Trademarks. This License does not grant permission to use the trade 141 | names, trademarks, service marks, or product names of the Licensor, 142 | except as required for reasonable and customary use in describing the 143 | origin of the Work and reproducing the content of the NOTICE file. 144 | 145 | 7. Disclaimer of Warranty. Unless required by applicable law or 146 | agreed to in writing, Licensor provides the Work (and each 147 | Contributor provides its Contributions) on an "AS IS" BASIS, 148 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 149 | implied, including, without limitation, any warranties or conditions 150 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 151 | PARTICULAR PURPOSE. You are solely responsible for determining the 152 | appropriateness of using or redistributing the Work and assume any 153 | risks associated with Your exercise of permissions under this License. 154 | 155 | 8. Limitation of Liability. In no event and under no legal theory, 156 | whether in tort (including negligence), contract, or otherwise, 157 | unless required by applicable law (such as deliberate and grossly 158 | negligent acts) or agreed to in writing, shall any Contributor be 159 | liable to You for damages, including any direct, indirect, special, 160 | incidental, or consequential damages of any character arising as a 161 | result of this License or out of the use or inability to use the 162 | Work (including but not limited to damages for loss of goodwill, 163 | work stoppage, computer failure or malfunction, or any and all 164 | other commercial damages or losses), even if such Contributor 165 | has been advised of the possibility of such damages. 166 | 167 | 9. Accepting Warranty or Additional Liability. While redistributing 168 | the Work or Derivative Works thereof, You may choose to offer, 169 | and charge a fee for, acceptance of support, warranty, indemnity, 170 | or other liability obligations and/or rights consistent with this 171 | License. However, in accepting such obligations, You may act only 172 | on Your own behalf and on Your sole responsibility, not on behalf 173 | of any other Contributor, and only if You agree to indemnify, 174 | defend, and hold each Contributor harmless for any liability 175 | incurred by, or claims asserted against, such Contributor by reason 176 | of your accepting any such warranty or additional liability. 177 | 178 | END OF TERMS AND CONDITIONS 179 | 180 | APPENDIX: How to apply the Apache License to your work. 181 | 182 | To apply the Apache License to your work, attach the following 183 | boilerplate notice, with the fields enclosed by brackets "{}" 184 | replaced with your own identifying information. (Don't include 185 | the brackets!) The text should be enclosed in the appropriate 186 | comment syntax for the file format. We also recommend that a 187 | file or class name and description of purpose be included on the 188 | same "printed page" as the copyright notice for easier 189 | identification within third-party archives. 190 | 191 | Copyright {yyyy} {name of copyright owner} 192 | 193 | Licensed under the Apache License, Version 2.0 (the "License"); 194 | you may not use this file except in compliance with the License. 195 | You may obtain a copy of the License at 196 | 197 | http://www.apache.org/licenses/LICENSE-2.0 198 | 199 | Unless required by applicable law or agreed to in writing, software 200 | distributed under the License is distributed on an "AS IS" BASIS, 201 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 202 | See the License for the specific language governing permissions and 203 | limitations under the License. 204 | -------------------------------------------------------------------------------- /module/Cornerstone/src/Console/Listener/BuildVirtualHost.php: -------------------------------------------------------------------------------- 1 | listeners[] = $pEventManager->attach(Service::EVENT_APPLICATION_INITIALIZE, $options, 1); 43 | $this->listeners[] = $pEventManager->attach(Service::EVENT_APPLICATION_BUILD_VHOST, $options, 1); 44 | } 45 | 46 | public function EventHandler (Console\Event $pEvent) 47 | { 48 | try 49 | { 50 | $console = $this->getServiceLocator()->get('console'); 51 | 52 | $config = $this->getServiceLocator()->get('Config'); 53 | 54 | if (true == $pEvent->getVerboseFlag()) 55 | { 56 | $console->write(' --------------- ', ColorInterface::LIGHT_GREEN); 57 | $console->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 58 | 59 | $console->write(" [Listener] ", ColorInterface::LIGHT_GREEN); 60 | $console->writeLine(__CLASS__, ColorInterface::YELLOW); 61 | 62 | $console->write(' --------------- ', ColorInterface::LIGHT_GREEN); 63 | $console->writeLine('-----------------------------------------------------------', ColorInterface::YELLOW); 64 | } 65 | 66 | if (true == $pEvent->getVerboseFlag()) 67 | { 68 | $console->write(" [Template Key] "); 69 | $console->writeLine($this->mTemplateKey, ColorInterface::YELLOW); 70 | } 71 | 72 | // create the view model for the vhost template 73 | $view = new ViewModel(); 74 | $view->setTemplate($this->mTemplateKey); 75 | 76 | $vhost_config = $config['Installation']['Vhost']; 77 | $server = $vhost_config['Server']; 78 | $prefix = $server['Prefix']; 79 | $region = $server['Region']; 80 | $domain = $server['Domain']; 81 | $suffix = $server['Suffix']; 82 | $view->setVariable('ServerName', $prefix . $region . $domain . $suffix); 83 | 84 | $public = $server['PublicFolder']; 85 | 86 | $view->setVariable('DocumentRoot', getcwd() . '/' . $public); 87 | $view->setVariable('ApplicationEnv', $pEvent->getEnvironment()); 88 | $view->setVariable('Config', $vhost_config); 89 | 90 | if (true == $pEvent->getVerboseFlag()) 91 | { 92 | $console->write(" [Server Name] "); 93 | $console->writeLine($view->getVariable('ServerName'), ColorInterface::YELLOW); 94 | 95 | $console->write(" [Document Root] "); 96 | $console->writeLine($view->getVariable('DocumentRoot'), ColorInterface::YELLOW); 97 | 98 | $console->write(" [Environment] "); 99 | $console->writeLine($view->getVariable('ApplicationEnv'), ColorInterface::YELLOW); 100 | } 101 | 102 | // setup specific configurations 103 | $view->setVariable('ApacheLogDir', $vhost_config['ApacheLog']); 104 | $view->setVariable('UseSyslog', $vhost_config['UseSysLog']); 105 | $view->setVariable('Ports', $vhost_config['Ports']); 106 | $view->setVariable('CorsOrigin', false); 107 | 108 | if ( array_key_exists('CorsOrigin', $config['Installation'] ) ) 109 | { 110 | $cors = $config['Installation']['CorsOrigin']; 111 | 112 | if ( false === is_array($cors)) 113 | { 114 | throw new Exception('CorsOrigin configuration must be an array.'); 115 | } 116 | 117 | $origin_list = implode('|', $cors); 118 | $view->setVariable('CorsOrigin', 'http(s)?://(' . $origin_list . ')'); 119 | } 120 | 121 | /** 122 | * Create a template map resolver from the template map in the config 123 | * file. 124 | * Using that we create a renderer that will parse the zf2 view 125 | * template like an ordinary template, so that we can get back its 126 | * contents 127 | */ 128 | $map = new TemplateMapResolver($config['view_manager']['template_map']); 129 | $renderer = new PhpRenderer(); 130 | $renderer->setResolver($map); 131 | 132 | // Rewrite/modsec rule additions 133 | $rewritePreView = new ViewModel(); 134 | $rewritePreView->setTemplate($this->mRewriteRulesPreTemplateKey); 135 | $rewritePreView->setVariable('Config', $vhost_config); 136 | $view->setVariable('RewritePreRules', $renderer->render($rewritePreView)); 137 | 138 | $rewritePostView = new ViewModel(); 139 | $rewritePostView->setTemplate($this->mRewriteRulesPostTemplateKey); 140 | $rewritePostView->setVariable('Config', $vhost_config); 141 | $view->setVariable('RewritePostRules', $renderer->render($rewritePostView)); 142 | 143 | $modSec = new ViewModel(); 144 | $modSec->setTemplate($this->mModsecTemplateKey); 145 | $modSec->setVariable('Config', $vhost_config); 146 | $view->setVariable('ModSecRules', $renderer->render($modSec)); 147 | 148 | if (true == $pEvent->getVerboseFlag()) 149 | { 150 | $console->write(" [View Template] "); 151 | $console->writeLine(realpath($map->get($this->mTemplateKey)), ColorInterface::YELLOW); 152 | } 153 | 154 | // write the vhost file here.... 155 | $vhost_extension = $server['Extension']; 156 | $vhost_path = $server['Path']; 157 | 158 | $vhost_filename = $view->getVariable('ServerName') . '.' . $vhost_extension; 159 | $vhost_file = $vhost_path . $vhost_filename; 160 | 161 | if (true == $pEvent->getVerboseFlag()) 162 | { 163 | $console->write(" [Apache VHost] "); 164 | $console->writeLine($vhost_file, ColorInterface::YELLOW); 165 | } 166 | 167 | if (false === is_dir($vhost_path)) 168 | { 169 | $result = mkdir($vhost_path, 0775, true); 170 | 171 | if (true === $result) 172 | { 173 | if (true == $pEvent->getVerboseFlag()) 174 | { 175 | $console->write(" [NOTICE] ", ColorInterface::LIGHT_CYAN); 176 | $console->writeLine("Vhost directory has been created.", ColorInterface::CYAN); 177 | } 178 | } 179 | else 180 | { 181 | if (true == $pEvent->getVerboseFlag()) 182 | { 183 | $console->write(" [Failure] ", ColorInterface::RED); 184 | $console->writeLine('Failed to create vhost directory, ' . $vhost_path . PHP_EOL, ColorInterface::RED); 185 | } 186 | 187 | throw new Exception('Failed to create vhost directory, ' . $vhost_path); 188 | } 189 | } 190 | 191 | if (false === is_writable($vhost_path)) 192 | { 193 | if (true == $pEvent->getVerboseFlag()) 194 | { 195 | $console->write(" [Failure] ", ColorInterface::RED); 196 | $console->writeLine("Vhost directory ($vhost_path) is not writable by web server." . PHP_EOL, ColorInterface::RED); 197 | } 198 | 199 | throw new Exception("Vhost directory ($vhost_path) is not writable by web server."); 200 | } 201 | 202 | if (file_exists($vhost_file) && false === $pEvent->getForceFlag()) 203 | { 204 | if (true == $pEvent->getVerboseFlag()) 205 | { 206 | $console->write(" [NOTICE] ", ColorInterface::LIGHT_CYAN); 207 | $console->writeLine('Apache VHost file already exists, skipping creation.', ColorInterface::CYAN); 208 | 209 | $console->write(" [INFO] ", ColorInterface::LIGHT_CYAN); 210 | $console->writeLine('To overwrite the existing file, use --force' . PHP_EOL, ColorInterface::CYAN); 211 | } 212 | } 213 | else if (file_exists($vhost_file) && false === is_writable($vhost_file)) 214 | { 215 | if (true == $pEvent->getVerboseFlag()) 216 | { 217 | $console->write(" [Failure] ", ColorInterface::RED); 218 | $console->writeLine('Apache VHost Not Writable!' . PHP_EOL, ColorInterface::RED); 219 | } 220 | 221 | throw new Exception(sprintf('Virtual host file %s is not writable.', $vhost_file)); 222 | } 223 | else 224 | { 225 | 226 | $pointer = fopen($vhost_file, 'w+'); 227 | if ($pointer === false) 228 | { 229 | if (true == $pEvent->getVerboseFlag()) 230 | { 231 | $console->write(" [Failure] ", ColorInterface::RED); 232 | $console->writeLine('Failed to open Apache VHost for writing!' . PHP_EOL, ColorInterface::RED); 233 | } 234 | 235 | throw new Exception(sprintf('Failed to open Virtual host file %s for writing.', $vhost_file)); 236 | } 237 | else 238 | { 239 | fwrite($pointer, $renderer->render($view)); 240 | fclose($pointer); 241 | 242 | if (true == $pEvent->getVerboseFlag()) 243 | { 244 | $console->write(' [Success] ', ColorInterface::LIGHT_GREEN); 245 | $console->writeLine('VHost File Update Complete' . PHP_EOL, ColorInterface::YELLOW); 246 | 247 | /* adding some extra spacing for the notice outside of this if block */ 248 | $console->write(' '); 249 | } 250 | 251 | $notice = $console->colorize('[NOTICE] ', ColorInterface::LIGHT_CYAN); 252 | 253 | $response = new Response(); 254 | $response->setContent($notice . 'Virtual Host file has been updated, you may need to restart/reload your web server.'); 255 | return $response; 256 | } 257 | } 258 | 259 | return NULL; 260 | } 261 | catch (Exception $e) 262 | { 263 | $response = new Response(); 264 | $response->setErrorLevel(1); 265 | $response->setContent('Exception Encountered: ' . $e->getMessage()); 266 | return $response; 267 | } 268 | } 269 | 270 | /** 271 | * Set service locator 272 | * 273 | * @param ServiceManager\ServiceLocatorInterface $serviceLocator 274 | */ 275 | public function setServiceLocator (ServiceManager\ServiceLocatorInterface $serviceLocator) 276 | { 277 | $this->mServiceLocator = $serviceLocator; 278 | } 279 | 280 | /** 281 | * Get service locator 282 | * 283 | * @return ServiceManager\ServiceLocatorInterface 284 | */ 285 | public function getServiceLocator () 286 | { 287 | return $this->mServiceLocator; 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "4dd624277ba0de1e1b27779c73e1a256", 8 | "packages": [ 9 | { 10 | "name": "zendframework/zendframework", 11 | "version": "2.3.2", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/zendframework/zf2.git", 15 | "reference": "0b74b66dc07ff88140287bdf67d230c1bd32ee0c" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://packages.zendframework.com/composer/zendframework-zendframework-0b74b66dc07ff88140287bdf67d230c1bd32ee0c-zip-9b89fd.zip", 20 | "reference": "2.3.2", 21 | "shasum": "ff3a5cbffa07c22894669eca7be0de818d3dad20" 22 | }, 23 | "require": { 24 | "php": ">=5.3.23", 25 | "zendframework/zendxml": "~1.0-dev" 26 | }, 27 | "replace": { 28 | "zendframework/zend-authentication": "self.version", 29 | "zendframework/zend-barcode": "self.version", 30 | "zendframework/zend-cache": "self.version", 31 | "zendframework/zend-captcha": "self.version", 32 | "zendframework/zend-code": "self.version", 33 | "zendframework/zend-config": "self.version", 34 | "zendframework/zend-console": "self.version", 35 | "zendframework/zend-crypt": "self.version", 36 | "zendframework/zend-db": "self.version", 37 | "zendframework/zend-debug": "self.version", 38 | "zendframework/zend-di": "self.version", 39 | "zendframework/zend-dom": "self.version", 40 | "zendframework/zend-escaper": "self.version", 41 | "zendframework/zend-eventmanager": "self.version", 42 | "zendframework/zend-feed": "self.version", 43 | "zendframework/zend-file": "self.version", 44 | "zendframework/zend-filter": "self.version", 45 | "zendframework/zend-form": "self.version", 46 | "zendframework/zend-http": "self.version", 47 | "zendframework/zend-i18n": "self.version", 48 | "zendframework/zend-inputfilter": "self.version", 49 | "zendframework/zend-json": "self.version", 50 | "zendframework/zend-ldap": "self.version", 51 | "zendframework/zend-loader": "self.version", 52 | "zendframework/zend-log": "self.version", 53 | "zendframework/zend-mail": "self.version", 54 | "zendframework/zend-math": "self.version", 55 | "zendframework/zend-memory": "self.version", 56 | "zendframework/zend-mime": "self.version", 57 | "zendframework/zend-modulemanager": "self.version", 58 | "zendframework/zend-mvc": "self.version", 59 | "zendframework/zend-navigation": "self.version", 60 | "zendframework/zend-paginator": "self.version", 61 | "zendframework/zend-permissions-acl": "self.version", 62 | "zendframework/zend-permissions-rbac": "self.version", 63 | "zendframework/zend-progressbar": "self.version", 64 | "zendframework/zend-resources": "self.version", 65 | "zendframework/zend-serializer": "self.version", 66 | "zendframework/zend-server": "self.version", 67 | "zendframework/zend-servicemanager": "self.version", 68 | "zendframework/zend-session": "self.version", 69 | "zendframework/zend-soap": "self.version", 70 | "zendframework/zend-stdlib": "self.version", 71 | "zendframework/zend-tag": "self.version", 72 | "zendframework/zend-test": "self.version", 73 | "zendframework/zend-text": "self.version", 74 | "zendframework/zend-uri": "self.version", 75 | "zendframework/zend-validator": "self.version", 76 | "zendframework/zend-version": "self.version", 77 | "zendframework/zend-view": "self.version", 78 | "zendframework/zend-xmlrpc": "self.version" 79 | }, 80 | "require-dev": { 81 | "doctrine/annotations": ">=1.0", 82 | "fabpot/php-cs-fixer": "dev-master", 83 | "ircmaxell/random-lib": "dev-master", 84 | "ircmaxell/security-lib": "dev-master", 85 | "mikey179/vfsstream": "1.2.*", 86 | "phpunit/phpunit": "3.7.*", 87 | "satooshi/php-coveralls": "dev-master", 88 | "sebastianbergmann/phpcov": "1.1.0" 89 | }, 90 | "suggest": { 91 | "doctrine/annotations": "Doctrine Annotations >=1.0 for annotation features", 92 | "ext-intl": "ext/intl for i18n features (included in default builds of PHP)", 93 | "ircmaxell/random-lib": "Fallback random byte generator for Zend\\Math\\Rand if OpenSSL/Mcrypt extensions are unavailable", 94 | "ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services", 95 | "zendframework/zendpdf": "ZendPdf for creating PDF representations of barcodes", 96 | "zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha for rendering ReCaptchas in Zend\\Captcha and/or Zend\\Form" 97 | }, 98 | "bin": [ 99 | "bin/classmap_generator.php", 100 | "bin/pluginmap_generator.php", 101 | "bin/templatemap_generator.php" 102 | ], 103 | "type": "library", 104 | "extra": { 105 | "branch-alias": { 106 | "dev-master": "2.3-dev", 107 | "dev-develop": "2.4-dev" 108 | } 109 | }, 110 | "autoload": { 111 | "psr-0": { 112 | "Zend\\": "library/" 113 | } 114 | }, 115 | "license": [ 116 | "BSD-3-Clause" 117 | ], 118 | "description": "Zend Framework 2", 119 | "homepage": "http://framework.zend.com/", 120 | "keywords": [ 121 | "framework", 122 | "zf2" 123 | ], 124 | "support": { 125 | "source": "https://github.com/zendframework/zf2/tree/release-2.3.2", 126 | "issues": "https://github.com/zendframework/zf2/issues" 127 | }, 128 | "time": "2014-08-12 16:48:34" 129 | }, 130 | { 131 | "name": "zendframework/zendxml", 132 | "version": "1.0.0", 133 | "source": { 134 | "type": "git", 135 | "url": "https://github.com/zendframework/ZendXml.git", 136 | "reference": "559b34f426d33a11c3db118e00ce14bb8dc64e5f" 137 | }, 138 | "dist": { 139 | "type": "zip", 140 | "url": "https://packages.zendframework.com/composer/zendframework-zendxml-559b34f426d33a11c3db118e00ce14bb8dc64e5f-zip-6cf7a2.zip", 141 | "reference": "1.0.0", 142 | "shasum": "39abc614b5c26bcbf8102e203c52dee73c4460a8" 143 | }, 144 | "require": { 145 | "php": ">=5.3.3" 146 | }, 147 | "require-dev": { 148 | "fabpot/php-cs-fixer": "*@dev", 149 | "phpunit/phpunit": "~3.7" 150 | }, 151 | "type": "library", 152 | "extra": { 153 | "branch-alias": { 154 | "dev-master": "1.0-dev" 155 | } 156 | }, 157 | "autoload": { 158 | "psr-0": { 159 | "ZendXml": "library/" 160 | } 161 | }, 162 | "license": [ 163 | "BSD-3-Clause" 164 | ], 165 | "description": "Utility library for XML usage, best practices, and security in PHP", 166 | "homepage": "http://packages.zendframework.com/", 167 | "keywords": [ 168 | "security", 169 | "xml", 170 | "zf2" 171 | ], 172 | "support": { 173 | "source": "https://github.com/zendframework/ZendXml/tree/master", 174 | "issues": "https://github.com/zendframework/ZendXml/issues" 175 | }, 176 | "time": "2014-03-05 22:25:44" 177 | } 178 | ], 179 | "packages-dev": [ 180 | { 181 | "name": "phpunit/php-code-coverage", 182 | "version": "1.2.17", 183 | "source": { 184 | "type": "git", 185 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 186 | "reference": "6ef2bf3a1c47eca07ea95f0d8a902a6340390b34" 187 | }, 188 | "dist": { 189 | "type": "zip", 190 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6ef2bf3a1c47eca07ea95f0d8a902a6340390b34", 191 | "reference": "6ef2bf3a1c47eca07ea95f0d8a902a6340390b34", 192 | "shasum": "" 193 | }, 194 | "require": { 195 | "php": ">=5.3.3", 196 | "phpunit/php-file-iterator": ">=1.3.0@stable", 197 | "phpunit/php-text-template": ">=1.2.0@stable", 198 | "phpunit/php-token-stream": ">=1.1.3@stable" 199 | }, 200 | "require-dev": { 201 | "phpunit/phpunit": "3.7.*@dev" 202 | }, 203 | "suggest": { 204 | "ext-dom": "*", 205 | "ext-xdebug": ">=2.0.5" 206 | }, 207 | "type": "library", 208 | "extra": { 209 | "branch-alias": { 210 | "dev-master": "1.2.x-dev" 211 | } 212 | }, 213 | "autoload": { 214 | "classmap": [ 215 | "PHP/" 216 | ] 217 | }, 218 | "notification-url": "https://packagist.org/downloads/", 219 | "include-path": [ 220 | "" 221 | ], 222 | "license": [ 223 | "BSD-3-Clause" 224 | ], 225 | "authors": [ 226 | { 227 | "name": "Sebastian Bergmann", 228 | "email": "sb@sebastian-bergmann.de", 229 | "role": "lead" 230 | } 231 | ], 232 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 233 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 234 | "keywords": [ 235 | "coverage", 236 | "testing", 237 | "xunit" 238 | ], 239 | "time": "2014-03-28 10:53:45" 240 | }, 241 | { 242 | "name": "phpunit/php-file-iterator", 243 | "version": "1.3.4", 244 | "source": { 245 | "type": "git", 246 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 247 | "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" 248 | }, 249 | "dist": { 250 | "type": "zip", 251 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", 252 | "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", 253 | "shasum": "" 254 | }, 255 | "require": { 256 | "php": ">=5.3.3" 257 | }, 258 | "type": "library", 259 | "autoload": { 260 | "classmap": [ 261 | "File/" 262 | ] 263 | }, 264 | "notification-url": "https://packagist.org/downloads/", 265 | "include-path": [ 266 | "" 267 | ], 268 | "license": [ 269 | "BSD-3-Clause" 270 | ], 271 | "authors": [ 272 | { 273 | "name": "Sebastian Bergmann", 274 | "email": "sb@sebastian-bergmann.de", 275 | "role": "lead" 276 | } 277 | ], 278 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 279 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 280 | "keywords": [ 281 | "filesystem", 282 | "iterator" 283 | ], 284 | "time": "2013-10-10 15:34:57" 285 | }, 286 | { 287 | "name": "phpunit/php-text-template", 288 | "version": "1.2.0", 289 | "source": { 290 | "type": "git", 291 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 292 | "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" 293 | }, 294 | "dist": { 295 | "type": "zip", 296 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", 297 | "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", 298 | "shasum": "" 299 | }, 300 | "require": { 301 | "php": ">=5.3.3" 302 | }, 303 | "type": "library", 304 | "autoload": { 305 | "classmap": [ 306 | "Text/" 307 | ] 308 | }, 309 | "notification-url": "https://packagist.org/downloads/", 310 | "include-path": [ 311 | "" 312 | ], 313 | "license": [ 314 | "BSD-3-Clause" 315 | ], 316 | "authors": [ 317 | { 318 | "name": "Sebastian Bergmann", 319 | "email": "sb@sebastian-bergmann.de", 320 | "role": "lead" 321 | } 322 | ], 323 | "description": "Simple template engine.", 324 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 325 | "keywords": [ 326 | "template" 327 | ], 328 | "time": "2014-01-30 17:20:04" 329 | }, 330 | { 331 | "name": "phpunit/php-timer", 332 | "version": "1.0.5", 333 | "source": { 334 | "type": "git", 335 | "url": "https://github.com/sebastianbergmann/php-timer.git", 336 | "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" 337 | }, 338 | "dist": { 339 | "type": "zip", 340 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", 341 | "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", 342 | "shasum": "" 343 | }, 344 | "require": { 345 | "php": ">=5.3.3" 346 | }, 347 | "type": "library", 348 | "autoload": { 349 | "classmap": [ 350 | "PHP/" 351 | ] 352 | }, 353 | "notification-url": "https://packagist.org/downloads/", 354 | "include-path": [ 355 | "" 356 | ], 357 | "license": [ 358 | "BSD-3-Clause" 359 | ], 360 | "authors": [ 361 | { 362 | "name": "Sebastian Bergmann", 363 | "email": "sb@sebastian-bergmann.de", 364 | "role": "lead" 365 | } 366 | ], 367 | "description": "Utility class for timing", 368 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 369 | "keywords": [ 370 | "timer" 371 | ], 372 | "time": "2013-08-02 07:42:54" 373 | }, 374 | { 375 | "name": "phpunit/php-token-stream", 376 | "version": "1.3.0", 377 | "source": { 378 | "type": "git", 379 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 380 | "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" 381 | }, 382 | "dist": { 383 | "type": "zip", 384 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", 385 | "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", 386 | "shasum": "" 387 | }, 388 | "require": { 389 | "ext-tokenizer": "*", 390 | "php": ">=5.3.3" 391 | }, 392 | "require-dev": { 393 | "phpunit/phpunit": "~4.2" 394 | }, 395 | "type": "library", 396 | "extra": { 397 | "branch-alias": { 398 | "dev-master": "1.3-dev" 399 | } 400 | }, 401 | "autoload": { 402 | "classmap": [ 403 | "src/" 404 | ] 405 | }, 406 | "notification-url": "https://packagist.org/downloads/", 407 | "license": [ 408 | "BSD-3-Clause" 409 | ], 410 | "authors": [ 411 | { 412 | "name": "Sebastian Bergmann", 413 | "email": "sebastian@phpunit.de" 414 | } 415 | ], 416 | "description": "Wrapper around PHP's tokenizer extension.", 417 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 418 | "keywords": [ 419 | "tokenizer" 420 | ], 421 | "time": "2014-08-31 06:12:13" 422 | }, 423 | { 424 | "name": "phpunit/phpunit", 425 | "version": "3.7.37", 426 | "source": { 427 | "type": "git", 428 | "url": "https://github.com/sebastianbergmann/phpunit.git", 429 | "reference": "ae6cefd7cc84586a5ef27e04bae11ee940ec63dc" 430 | }, 431 | "dist": { 432 | "type": "zip", 433 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ae6cefd7cc84586a5ef27e04bae11ee940ec63dc", 434 | "reference": "ae6cefd7cc84586a5ef27e04bae11ee940ec63dc", 435 | "shasum": "" 436 | }, 437 | "require": { 438 | "ext-ctype": "*", 439 | "ext-dom": "*", 440 | "ext-json": "*", 441 | "ext-pcre": "*", 442 | "ext-reflection": "*", 443 | "ext-spl": "*", 444 | "php": ">=5.3.3", 445 | "phpunit/php-code-coverage": "~1.2", 446 | "phpunit/php-file-iterator": "~1.3", 447 | "phpunit/php-text-template": "~1.1", 448 | "phpunit/php-timer": "~1.0", 449 | "phpunit/phpunit-mock-objects": "~1.2", 450 | "symfony/yaml": "~2.0" 451 | }, 452 | "require-dev": { 453 | "pear-pear.php.net/pear": "1.9.4" 454 | }, 455 | "suggest": { 456 | "phpunit/php-invoker": "~1.1" 457 | }, 458 | "bin": [ 459 | "composer/bin/phpunit" 460 | ], 461 | "type": "library", 462 | "extra": { 463 | "branch-alias": { 464 | "dev-master": "3.7.x-dev" 465 | } 466 | }, 467 | "autoload": { 468 | "classmap": [ 469 | "PHPUnit/" 470 | ] 471 | }, 472 | "notification-url": "https://packagist.org/downloads/", 473 | "include-path": [ 474 | "", 475 | "../../symfony/yaml/" 476 | ], 477 | "license": [ 478 | "BSD-3-Clause" 479 | ], 480 | "authors": [ 481 | { 482 | "name": "Sebastian Bergmann", 483 | "email": "sebastian@phpunit.de", 484 | "role": "lead" 485 | } 486 | ], 487 | "description": "The PHP Unit Testing framework.", 488 | "homepage": "http://www.phpunit.de/", 489 | "keywords": [ 490 | "phpunit", 491 | "testing", 492 | "xunit" 493 | ], 494 | "time": "2014-04-30 12:24:19" 495 | }, 496 | { 497 | "name": "phpunit/phpunit-mock-objects", 498 | "version": "1.2.3", 499 | "source": { 500 | "type": "git", 501 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 502 | "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" 503 | }, 504 | "dist": { 505 | "type": "zip", 506 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", 507 | "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", 508 | "shasum": "" 509 | }, 510 | "require": { 511 | "php": ">=5.3.3", 512 | "phpunit/php-text-template": ">=1.1.1@stable" 513 | }, 514 | "suggest": { 515 | "ext-soap": "*" 516 | }, 517 | "type": "library", 518 | "autoload": { 519 | "classmap": [ 520 | "PHPUnit/" 521 | ] 522 | }, 523 | "notification-url": "https://packagist.org/downloads/", 524 | "include-path": [ 525 | "" 526 | ], 527 | "license": [ 528 | "BSD-3-Clause" 529 | ], 530 | "authors": [ 531 | { 532 | "name": "Sebastian Bergmann", 533 | "email": "sb@sebastian-bergmann.de", 534 | "role": "lead" 535 | } 536 | ], 537 | "description": "Mock Object library for PHPUnit", 538 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 539 | "keywords": [ 540 | "mock", 541 | "xunit" 542 | ], 543 | "time": "2013-01-13 10:24:48" 544 | }, 545 | { 546 | "name": "symfony/yaml", 547 | "version": "v2.5.3", 548 | "target-dir": "Symfony/Component/Yaml", 549 | "source": { 550 | "type": "git", 551 | "url": "https://github.com/symfony/Yaml.git", 552 | "reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f" 553 | }, 554 | "dist": { 555 | "type": "zip", 556 | "url": "https://api.github.com/repos/symfony/Yaml/zipball/5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f", 557 | "reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f", 558 | "shasum": "" 559 | }, 560 | "require": { 561 | "php": ">=5.3.3" 562 | }, 563 | "type": "library", 564 | "extra": { 565 | "branch-alias": { 566 | "dev-master": "2.5-dev" 567 | } 568 | }, 569 | "autoload": { 570 | "psr-0": { 571 | "Symfony\\Component\\Yaml\\": "" 572 | } 573 | }, 574 | "notification-url": "https://packagist.org/downloads/", 575 | "license": [ 576 | "MIT" 577 | ], 578 | "authors": [ 579 | { 580 | "name": "Symfony Community", 581 | "homepage": "http://symfony.com/contributors" 582 | }, 583 | { 584 | "name": "Fabien Potencier", 585 | "email": "fabien@symfony.com" 586 | } 587 | ], 588 | "description": "Symfony Yaml Component", 589 | "homepage": "http://symfony.com", 590 | "time": "2014-08-05 09:00:40" 591 | } 592 | ], 593 | "aliases": [ 594 | 595 | ], 596 | "minimum-stability": "stable", 597 | "stability-flags": [ 598 | 599 | ], 600 | "platform": { 601 | "php": ">=5.4" 602 | }, 603 | "platform-dev": [ 604 | 605 | ] 606 | } 607 | --------------------------------------------------------------------------------