Skip to content

Commit

Permalink
Initial commit of emvisee.
Browse files Browse the repository at this point in the history
  • Loading branch information
leanderlee committed Mar 31, 2011
0 parents commit edc560f
Show file tree
Hide file tree
Showing 425 changed files with 31,449 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .htaccess
@@ -0,0 +1,16 @@
Options +FollowSymLinks
RewriteEngine On

#
# Development Rules
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [L]

#
# Production Rules
#
#RewriteCond %{REQUEST_FILENAME} !-f [OR]
#RewriteCond %{REQUEST_URI} !^/static/.*
#RewriteRule ^.*$ index.php [L]

19 changes: 19 additions & 0 deletions LICENSE
@@ -0,0 +1,19 @@
Copyright (C) 2011 by Leander Lee

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

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

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

Emvisee (pronounced MVC)
By Leander Lee

Created: Mar 24, 2011

Contains:
- controllers
- templating
- services
- useful php classes
- (basic) testing suite
- jquery minimized


Is a really lightweight mvc framework
for PHP, similar to many of the existing
frameworks out there. However, I chose
to do my own, because it uses autoloading
static classes, so that the controllers
do not have any additional markup.

This was created because:
- There aren't enough php frameworks (lol)
- I needed something light(er) weight
- I wanted something that looked nice
(ie, none of that $, ->, @ crap.)
- Had automated testing

The router is compact and unit-tested.
This uses Twig for templating (sensiolabs).
I also wrote a (basic) testing framework.


INSTALLATION
Just copy it into webroot.
Edit settings.conf and hide from world.

USAGE
There are three things:
<webroot>/
<webroot>/tests/
<webroot>/get/


controllers/
contains .php files with a single
class called <filename>_controller.
lib/
contains .php files with a single
class called <filename>. This is
automatically loaded when called.
static/
hosts all css, images and js files.
tml/
contains .tml files in folders
associated to the controller file.
More information about the template
language and syntax can be found at:
http://www.twig-project.org/doc/templates.html
tests/
contains .test files which can be run
by the test suite.



116 changes: 116 additions & 0 deletions cache/__TwigTemplate_2fdbcabd7508ab4cb1ba96b2aca394ac.php
@@ -0,0 +1,116 @@
<?php

/* tests/all.tml */
class __TwigTemplate_2fdbcabd7508ab4cb1ba96b2aca394ac extends Twig_Template
{
protected $parent;

public function __construct(Twig_Environment $env)
{
parent::__construct($env);

$this->blocks = array(
'styles' => array($this, 'block_styles'),
'scripts' => array($this, 'block_scripts'),
'page' => array($this, 'block_page'),
);
}

public function getParent(array $context)
{
if (null === $this->parent) {
$this->parent = $this->env->loadTemplate("default.tml");
}

return $this->parent;
}

public function display(array $context, array $blocks = array())
{
$this->getParent($context)->display($context, array_merge($this->blocks, $blocks));
}

// line 3
public function block_styles($context, array $blocks = array())
{
echo "<style type=\"text/css\">
div.title { font: 3em/2em black; padding: 5px 30px; }
div.info { font: 1.4em/1.6em black; padding: 4px 50px; }
a.test { font: 2em/2em black; margin: 0; padding: 0 35px; }
div.passed { background: #9EF7B5; }
div.failed { background: #F5CECE; }
</style>
";
}

// line 13
public function block_scripts($context, array $blocks = array())
{
echo "<script type=\"text/javascript\">
\$(function () {
\$('.module').each(function () {
if (\$(this).find('.failed').size() > 0) {
\$(this).addClass('failed');
}
else {
\$(this).addClass('passed');
}
});
});
</script>
";
}

// line 28
public function block_page($context, array $blocks = array())
{
echo "<div class=\"title\">Unit Tests</div>
<div class=\"info\">";
// line 30
echo (isset($context['total_tests']) ? $context['total_tests'] : null);
echo " tests.</div>
";
// line 31
$context['_parent'] = (array) $context;
$context['_seq'] = twig_iterator_to_array((isset($context['tests']) ? $context['tests'] : null));
$countable = is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable);
$length = $countable ? count($context['_seq']) : null;
$context['loop'] = array(
'parent' => $context['_parent'],
'index0' => 0,
'index' => 1,
'first' => true,
);
if ($countable) {
$context['loop']['revindex0'] = $length - 1;
$context['loop']['revindex'] = $length;
$context['loop']['length'] = $length;
$context['loop']['last'] = 1 === $length;
}
foreach ($context['_seq'] as $context['_key'] => $context['test']) {
echo "<a href=\"tests/";
// line 32
echo (isset($context['test']) ? $context['test'] : null);
echo "/\" class=\"test\">";
echo (isset($context['test']) ? $context['test'] : null);
echo "</a>
";
++$context['loop']['index0'];
++$context['loop']['index'];
$context['loop']['first'] = false;
if ($countable) {
--$context['loop']['revindex0'];
--$context['loop']['revindex'];
$context['loop']['last'] = 0 === $context['loop']['revindex0'];
}
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['test'], $context['_parent'], $context['loop']);
$context = array_merge($_parent, array_intersect_key($context, $_parent));
}

public function getTemplateName()
{
return "tests/all.tml";
}
}
66 changes: 66 additions & 0 deletions cache/__TwigTemplate_67775347864cd021ded8f98d1269637e.php
@@ -0,0 +1,66 @@
<?php

/* common/javascript.tml */
class __TwigTemplate_67775347864cd021ded8f98d1269637e extends Twig_Template
{
public function display(array $context, array $blocks = array())
{
// line 5
echo "
";
// line 7
echo "
";
// line 9
echo "
";
// line 11
echo "
";
}

// line 7
public function getsrc($file = null)
{
$context = array(
"file" => $file,
);

echo "<script type=\"text/javascript\" src=\"static/js/";
echo (isset($context['file']) ? $context['file'] : null);
echo ".js\"></script>";
}

// line 9
public function getcorners()
{
$context = array(
);

echo $this->getAttribute($this, "src", array("jquery.corner.min", ), "method");
}

// line 11
public function getui()
{
$context = array(
);

echo $this->getAttribute($this, "src", array("jqueryui.min", ), "method");
}

// line 13
public function getjquery()
{
$context = array(
);

echo $this->getAttribute($this, "src", array("jquery.min", ), "method");
}

public function getTemplateName()
{
return "common/javascript.tml";
}
}

0 comments on commit edc560f

Please sign in to comment.