diff --git a/README.md b/README.md index b799738..dad8b78 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -cubexio +cubex.io ======= -Cubex Website +This is the office source for the cubex.io website diff --git a/assets/css/base.css b/assets/css/base.css new file mode 100644 index 0000000..7917148 --- /dev/null +++ b/assets/css/base.css @@ -0,0 +1,126 @@ +/* OVERRIDES */ +body { + padding: 0; + font-family: 'Open Sans', sans-serif; +} + +/** HELPERS */ +.text-center { + text-align: center; +} + +.strtoupper { + text-transform: uppercase; +} + +/** STICKY FOOTER */ +html, +body { + height: 100%; +} + +#sf-wrap { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -155px; +} + +#sf-push { + height: 155px; +} + +footer { + height: 155px; + line-height: 20px; +} + +/** GLOBAL STYLES */ +header { + background: #4099d4; + background: -moz-linear-gradient(left, #4099d4 0%, #84cbf0 50%, #4099d4 100%); + background: -webkit-gradient(linear, left top, right top, color-stop(0%, #4099d4), color-stop(50%, #84cbf0), color-stop(100%, #4099d4)); + background: -webkit-linear-gradient(left, #4099d4 0%, #84cbf0 50%, #4099d4 100%); + background: -o-linear-gradient(left, #4099d4 0%, #84cbf0 50%, #4099d4 100%); + background: -ms-linear-gradient(left, #4099d4 0%, #84cbf0 50%, #4099d4 100%); + background: linear-gradient(to right, #4099d4 0%, #84cbf0 50%, #4099d4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4099d4', endColorstr='#4099d4', GradientType=1); +} + +header#topbar { + padding-bottom: 16px; + border-bottom: 3px solid #DEDEDE; +} + +header#topbar .logo { + margin-top: 16px; + opacity: 0.8; +} + +header#topbar .logo:hover { + opacity: 1; +} + +nav.main { + margin-top: 29px; +} + +header nav > ul > li > a { + padding: 0 7px; + color: #30719c; + text-shadow: 0 1px 0 #67b5e4; +} + +header nav > ul > li > a:hover, +header nav > ul > li.active > a { + text-decoration: none; + color: #fff; + text-shadow: 0 1px 0 #3f8dc5; +} + +footer { + background: #E9E9E9; + font-size: 11px; + padding-top: 14px; + border-top: 1px solid #CCC; +} + +footer hr { + border: 0; + border-top: 1px solid #CCC; + margin: 5px 0; +} + +.container { + max-width: 960px; +} + +pre +{ + border:1px solid #55a8dd; +} + +pre code,code { + padding: 0; + color: #e9604a; + display: block; + overflow: hidden; + white-space: pre-wrap; + word-wrap: break-word; + font-family: monospace; + background: #eeeeee; + border-radius: 5px; + text-shadow: none; +} + +code +{ + background:transparent !important; +} + + + +.home-features .panel +{ + min-height:250px; +} diff --git a/assets/css/hero.css b/assets/css/hero.css new file mode 100644 index 0000000..1b195fe --- /dev/null +++ b/assets/css/hero.css @@ -0,0 +1,45 @@ +header#topbar { + border-bottom: none; +} + +header.hero { + font-size: 18px; + padding: 20px 0; + border-bottom: 3px solid #DEDEDE; + color: #ffffff; +} + +header.hero h1 { + text-align: center; + font-family: Calibri, 'Open Sans', sans-serif; + font-weight: 400; + font-size: 53px; + margin-top: 15px; + text-shadow: 0 2px 0 #3b8ec8; +} + +header.hero a:hover { + text-decoration: none; +} + +header.hero a { + color: #ffffff; +} + +header.hero aside { + display: block; + float: right; + width: 440px; + padding-top: 15px; + text-shadow: 0 1px 0 #3b8ec8; +} + +header.hero hgroup { + float: left; + width: 440px; +} + +.hero-links +{ + padding-top:10px; +} diff --git a/assets/img/cubex-logo.png b/assets/img/cubex-logo.png new file mode 100644 index 0000000..b8a819a Binary files /dev/null and b/assets/img/cubex-logo.png differ diff --git a/assets/img/highlight.png b/assets/img/highlight.png new file mode 100644 index 0000000..bcd174d Binary files /dev/null and b/assets/img/highlight.png differ diff --git a/assets/img/icons-cubes-sprite.png b/assets/img/icons-cubes-sprite.png new file mode 100644 index 0000000..bf89e71 Binary files /dev/null and b/assets/img/icons-cubes-sprite.png differ diff --git a/assets/img/watermark.png b/assets/img/watermark.png new file mode 100644 index 0000000..cf91fa8 Binary files /dev/null and b/assets/img/watermark.png differ diff --git a/assets/sprites/icons-cubes-sprite.psd b/assets/sprites/icons-cubes-sprite.psd new file mode 100644 index 0000000..1b17534 Binary files /dev/null and b/assets/sprites/icons-cubes-sprite.psd differ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4e5353e --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "cubex/cubexio", + "description": "Cubex Website", + "homepage": "http://cubex.io", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Brooke Bryan", + "email": "brooke@bajb.net", + "homepage": "http://www.bajb.net" + } + ], + "require": { + "cubex/framework": "*", + "stack/builder": "*", + "packaged/dispatch": "*", + "dflydev/markdown": "*" + }, + "autoload": { + "psr-4": { + "CubexIo\\": "src/" + } + }, + "minimum-stability": "dev" +} diff --git a/conf/defaults.ini b/conf/defaults.ini new file mode 100644 index 0000000..1d05e04 --- /dev/null +++ b/conf/defaults.ini @@ -0,0 +1,10 @@ +[kernel] +default = \CubexIo\CubexIoApplication + +[dispatch] +run_on = path +run_match = assets +assets_dir = assets + +[documentation] +source_path = /Websites/cubex/documentation/ diff --git a/cubex b/cubex new file mode 100755 index 0000000..3c8636a --- /dev/null +++ b/cubex @@ -0,0 +1,30 @@ +#!/usr/bin/env php +boot(); + +//Create a request object +$request = \Cubex\Http\Request::createConsoleRequest(); +$app->instance('request', $request); + +//Create a new console application +$console = \Cubex\Console\Console::withCubex($app); + +//Execute the command and retrieve the exit code +$exit = $console->run(); + +$app->shutdown(); + +exit($exit); diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..a63a530 --- /dev/null +++ b/public/index.php @@ -0,0 +1,32 @@ +boot(); + +$dispatcher = new \Packaged\Dispatch\Dispatch( + $app, $app->getConfiguration()->getSection('dispatch') +); +$dispatcher->setBaseDirectory(dirname(__DIR__)); + +//If you wish to use stackphp, uncomment the line below and require stackphp +$app = (new \Stack\Builder()) + ->push([$dispatcher, 'prepare']) + ->resolve($app); + +//Create a request object +$request = \Cubex\Http\Request::createFromGlobals(); + +//Tell Cubex to handle the request, and do its magic +$response = $app->handle($request); + +//Send the generated response to the user +$response->send(); + +//Shutdown Cubex +$app->terminate($request, $response); diff --git a/src/Controllers/CookbookController.php b/src/Controllers/CookbookController.php new file mode 100644 index 0000000..8d0b5e4 --- /dev/null +++ b/src/Controllers/CookbookController.php @@ -0,0 +1,12 @@ +_layout === null) + { + $this->_layout = new Layout($this); + $am = AssetManager::assetType(); + $am->requireCss('css/base'); + } + + return $this->_layout; + } + + public function __toString() + { + return $this->layout()->render(); + } + + public function handleResponse($response, $capturedOutput) + { + if($response instanceof ViewModel) + { + $this->layout()->insert($response, $this->_contentName); + return new Response($this->layout()); + } + + if($response === null) + { + $this->layout()->insert( + new Renderable($capturedOutput), + $this->_contentName + ); + return new Response($this->layout()); + } + + if(is_scalar($response)) + { + $this->layout()->insert( + new Renderable($response), + $this->_contentName + ); + return new Response($this->layout()); + } + + return parent::handleResponse($response, $capturedOutput); + } +} diff --git a/src/Controllers/DocumentationController.php b/src/Controllers/DocumentationController.php new file mode 100644 index 0000000..ee1ef98 --- /dev/null +++ b/src/Controllers/DocumentationController.php @@ -0,0 +1,42 @@ +getConfigItem('documentation', "source_path", 'docs'); + if(substr($docRoot, 0, 1) !== '/' && substr($docRoot, 1, 1) !== ':') + { + $docRoot = build_path($this->getCubex()->getDocRoot(), $docRoot); + } + + $sidebar = file_get_contents($docRoot . 'contents.md'); + if(file_exists($docRoot . $page . '.md')) + { + $content = file_get_contents($docRoot . $page . '.md'); + } + else + { + $errorString = 'File Not Found'; + } + + $docs = new Documentation($sidebar, $content); + $docs->setError($errorString); + return $docs; + } +} diff --git a/src/Controllers/GenericController.php b/src/Controllers/GenericController.php new file mode 100644 index 0000000..2b69661 --- /dev/null +++ b/src/Controllers/GenericController.php @@ -0,0 +1,18 @@ +layout()); + } +} diff --git a/src/Controllers/GettingStartedController.php b/src/Controllers/GettingStartedController.php new file mode 100644 index 0000000..ebc1a7a --- /dev/null +++ b/src/Controllers/GettingStartedController.php @@ -0,0 +1,12 @@ +configureMarkdownParser(self::CONFIG_TAB_WIDTH, 2); + } + + function _doCodeBlocks_callback($matches) + { + $codeblock = $matches[1]; + + $codeblock = $this->outdent($codeblock); + $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES); + + # trim leading newlines and trailing newlines + $codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock); + return $this->wrapCodeBlock($codeblock); + } + + function _doFencedCodeBlocks_callback($matches) + { + $codeblock = $matches[2]; + $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES); + $codeblock = preg_replace_callback( + '/^\n+/', + array(&$this, '_doFencedCodeBlocks_newlines'), + $codeblock + ); + return $this->wrapCodeBlock($codeblock); + } + + public function wrapCodeBlock($code) + { + $code = "
$code\n
"; + return "\n\n" . $this->hashBlock($code) . "\n\n"; + } +} diff --git a/src/Layouts/Default.phtml b/src/Layouts/Default.phtml new file mode 100644 index 0000000..472b965 --- /dev/null +++ b/src/Layouts/Default.phtml @@ -0,0 +1,124 @@ + + Cubex + + + + + + $opt) + { + echo ''; + } + ?> + + +
+
+ +
+ + hero(); ?> + +
+ content(); ?> +
+ +
+ +
+ + + + + diff --git a/src/Templates/ComingSoon.phtml b/src/Templates/ComingSoon.phtml new file mode 100644 index 0000000..3651dd4 --- /dev/null +++ b/src/Templates/ComingSoon.phtml @@ -0,0 +1,3 @@ +
+

getFeature(); ?> are Coming Soon

+

Wont be long, promise :)

diff --git a/src/Templates/Documentation.phtml b/src/Templates/Documentation.phtml new file mode 100644 index 0000000..2806c1b --- /dev/null +++ b/src/Templates/Documentation.phtml @@ -0,0 +1,17 @@ +
+
+
getSidebar(); ?>
+
+ hasError()) + { + ?> +
+ getError(); ?> +
+ + getContent(); ?> +
+
diff --git a/src/Templates/HeroBanner.phtml b/src/Templates/HeroBanner.phtml new file mode 100644 index 0000000..6db19af --- /dev/null +++ b/src/Templates/HeroBanner.phtml @@ -0,0 +1,20 @@ +
+
+
+

Get started with Cubex today!

+
+ +
+
diff --git a/src/Templates/Homepage.phtml b/src/Templates/Homepage.phtml new file mode 100644 index 0000000..2eacf3d --- /dev/null +++ b/src/Templates/Homepage.phtml @@ -0,0 +1,154 @@ +
+
+
+

What is Cubex?

+
+
+

Cubex is an open source PHP framework designed around performance and + simplicity. Cubex act as the glue for some great PHP packages, aiming to + offer a consistent environment making development easier.

+
+
+ +
+
+
+ +
+
+

+ + Performance +

+
+
+

Cubex is focused on optimising the speed of every request to ensure + your + code + operates as fast as possible.

+ +

Cubex is used within many high scale web applications and backends + which + demand performance to be at its best.

+
+
+ +
+
+
+
+

+ + Simplicity +

+
+
+

There is no need to be writing boiler plate code these days. + Cubex works to reducing the amount of code required to produce some + amazing + results, while supporting developers wishing to push the + boundries.

+
+
+ +
+
+ +
+
+

+ + Fully Tested +

+
+
+

All code within cubex aims to have 100% code coverage, and test as + many + variations of user or developer input as possible.

+ +

Test cases are constantly maintained with new functionality, and we + aim + to + write tests for every bug fixed & found, to ensure it doesn't + ever + come + back.

+
+
+ +
+
+ +
+
+
+
+

+ + Automatic & Simple Routing +

+
+
+

Just create your classes that extend the various available Cubex + Kernels, + and + the hard work is done for you.

+ +

Where you do need a slight variation on your routes, every layer is + able + to + handle custom routing and redirects for you.

+ +
+
+ +
+
+ +
+
+

+ + Code To Conventions +

+
+
+

By following various conventions in naming and structure, Cubex + will + take + care of the rest for you.

+ +

You no longer need to write routes, spend hours defining every + parameter + in + your console commands.

+
+
+ +
+
+ +
+
+

+ + Solid Foundations +

+
+
+

Cubex where possible uses available packages from the community, + with + the + HTTP foundation coming from Symfony and the IOC container coming + from + Laravel.

+ +

Cubex aims to simply provide you with the wrapping ontop of great + community + php packages.

+
+
+ +
+
+
diff --git a/src/Templates/Licence.phtml b/src/Templates/Licence.phtml new file mode 100644 index 0000000..37d9238 --- /dev/null +++ b/src/Templates/Licence.phtml @@ -0,0 +1,35 @@ +
+
+ +

 

+

Copyright (c) 2012-, Just Develop It Ltd

+

All rights reserved.

+

+

Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met:

+

+

Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer.

+

+

Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution.

+

+

Neither the name of Just Develop It Ltd may be used to endorse or promote + products derived from this software without specific prior written + permission.

+

+

THIS SOFTWARE IS PROVIDED BY Just Develop It Ltd "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL Just Develop It Ltd BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ +
+
diff --git a/src/Views/Documentation.php b/src/Views/Documentation.php new file mode 100644 index 0000000..6755afb --- /dev/null +++ b/src/Views/Documentation.php @@ -0,0 +1,51 @@ +_sidebarMd = $sidebarMarkdown; + $this->_contentMd = $contentMarkdown; + $this->_mdEngine = new SiteMarkdown(); + } + + public function setError($error) + { + $this->_error = $error; + return $this; + } + + public function hasError() + { + return $this->_error !== null; + } + + public function getError() + { + switch($this->_error) + { + case 404: + return "The page you requested was not found."; + } + return null; + } + + public function getSidebar() + { + return $this->_mdEngine->transformMarkdown($this->_sidebarMd); + } + + public function getContent() + { + return $this->_mdEngine->transformMarkdown($this->_contentMd); + } +} diff --git a/src/Views/HeroBanner.php b/src/Views/HeroBanner.php new file mode 100644 index 0000000..5289c25 --- /dev/null +++ b/src/Views/HeroBanner.php @@ -0,0 +1,13 @@ +requireCss('css/hero'); + } +} diff --git a/src/Views/Homepage.php b/src/Views/Homepage.php new file mode 100644 index 0000000..fb1e81e --- /dev/null +++ b/src/Views/Homepage.php @@ -0,0 +1,13 @@ +insert(new HeroBanner(), 'hero'); + } +} diff --git a/src/Views/Licence.php b/src/Views/Licence.php new file mode 100644 index 0000000..dd21125 --- /dev/null +++ b/src/Views/Licence.php @@ -0,0 +1,9 @@ +