Permalink
Browse files

Initial git commit

  • Loading branch information...
clphillips committed Mar 11, 2013
0 parents commit 7d9325b488d2e7a40232de4c19ef7a3af04eac24
Showing with 7,707 additions and 0 deletions.
  1. +25 −0 LICENSE.md
  2. +86 −0 README.md
  3. +140 −0 build.xml
  4. +67 −0 build/apigen.neon
  5. +3 −0 build/logs/apigen.txt
  6. +5 −0 build/logs/jdepend.xml
  7. +4 −0 build/logs/junit.xml
  8. +2 −0 build/logs/phploc.csv
  9. +2 −0 build/logs/pmd-cpd.xml
  10. +3 −0 build/logs/pmd.xml
  11. +120 −0 build/phpcs.xml
  12. +12 −0 build/phpmd.xml
  13. +33 −0 build/phpunit.xml
  14. +10 −0 src/.htaccess
  15. +15 −0 src/app/app_controller.php
  16. +13 −0 src/app/app_model.php
  17. +13 −0 src/app/controllers/404.php
  18. +10 −0 src/app/controllers/main.php
  19. +9 −0 src/app/views/default/_404.pdt
  20. +41 −0 src/app/views/default/css/styles.css
  21. +20 −0 src/app/views/default/main.pdt
  22. +12 −0 src/app/views/default/structure.pdt
  23. +33 −0 src/app/views/errors/css/styles.css
  24. +8 −0 src/app/views/errors/error.pdt
  25. +12 −0 src/app/views/errors/structure.pdt
  26. +281 −0 src/components/acl/acl.php
  27. +22 −0 src/components/acl/acl.sql
  28. +580 −0 src/components/input/input.php
  29. +1,422 −0 src/components/record/record.php
  30. +279 −0 src/components/session/session.php
  31. +7 −0 src/components/session/session.sql
  32. +61 −0 src/config/core.php
  33. +47 −0 src/config/database.php
  34. +21 −0 src/config/routes.php
  35. +21 −0 src/config/session.php
  36. +389 −0 src/helpers/date/date.php
  37. +618 −0 src/helpers/form/form.php
  38. +207 −0 src/helpers/html/html.php
  39. +130 −0 src/helpers/javascript/javascript.php
  40. +6 −0 src/helpers/pagination/language/en_us/pagination.php
  41. +430 −0 src/helpers/pagination/pagination.php
  42. +122 −0 src/helpers/xml/xml.php
  43. +46 −0 src/index.php
  44. +91 −0 src/lib/cache.php
  45. +103 −0 src/lib/configure.php
  46. +325 −0 src/lib/controller.php
  47. +195 −0 src/lib/dispatcher.php
  48. +131 −0 src/lib/init.php
  49. +155 −0 src/lib/language.php
  50. +224 −0 src/lib/loader.php
  51. +282 −0 src/lib/model.php
  52. +219 −0 src/lib/router.php
  53. +34 −0 src/lib/stdlib.php
  54. +88 −0 src/lib/unknown_exception.php
  55. +153 −0 src/lib/view.php
  56. +10 −0 tests/ExpectedErrorTest.php
  57. +8 −0 tests/bootstrap.php
  58. +285 −0 tests/components/input/InputTest.php
  59. +17 −0 tests/components/record/RecordTest.php
@@ -0,0 +1,25 @@
+# MIT License #
+
+Copyright (c) 2010-2013 [Phillips Data, Inc.](https://github.com/phillipsdata)
+Copyright (c) 2009-2013 [Cody Phillips](https://github.com/clphillips)
+
+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.
@@ -0,0 +1,86 @@
+# minPHP #
+
+minPHP is an extremely lightweight MVC framework for PHP application development.
+
+## Requirements ##
+
+* PHP 5.1.3 or greater
+
+## Getting Started ##
+
+1. Extract all the contents of the /src/ directory to a publically accessible web directory.
+2. Load the web directory in your browser.
+3. If your webserver does not support .htaccess files, delete the .htaccess file in the /src/ directory. You will need to access all URIs with a preceding "index.php/".
+
+### Controlls, Views, and URIs ###
+
+**Controllers** are PHP class files that handle URI requests. Each controller and controller method (known as an **action**) represent a URI segment. For example, the "Foo" controller can be accessed at ```/foo/```. This would automatically invoke the ```Foo::index()``` method. This method could explicitly be invoked using the ```/foo/index/``` URI. Similarly, the "bar" method of Foo can be accessed at ```/foo/bar/```.
+
+Each **View** is linked to a specific action. That is, each controller method has its own view. A view is simply a PHP Data Template (.pdt file), which typically contain HTML and PHP. The view for ```/foo/index/``` would be ```foo.pdt```. The view for ```/foo/bar/``` would be ```foo_bar.pdt```. Views are located in the ```/src/app/views/default/``` directory.
+
+Controllers are initialized with two view objects. One for the action's view and another called "structure". The structure view (```/src/app/views/default/structure.pdt```) contains the content used in all views.
+
+### Passing Variables to Views ###
+
+Passing variables to views from a controller is simple:
+
+```php
+<?php
+class Foo extends AppController {
+
+ public function index() {
+
+ $my_var = array(1,2,3);
+
+ $this->set("my_var", $my_var);
+ }
+
+}
+?>
+```
+
+You can also set multiple variables all at once:
+
+```php
+<?php
+class Foo extends AppController {
+
+ public function index() {
+
+ $my_var = array(1,2,3);
+ $my_other_var = array("a","b","c");
+
+ $this->set(compact("my_var", "my_other_var"));
+ }
+
+}
+?>
+```
+
+To set variables in the structure view use:
+
+```php
+$this->structure->set("my_var", $my_var);
+```
+
+### Directory Structure ###
+
+<pre>
+/app
+ /controllers - where all controllers are to be placed
+ /models - where all models are to be placed
+ /views - where all views are to be placed
+ /default - a collection of related display components
+ /css
+ /images
+ /javascript
+/cache - where cached views are stored (must be writable to use)
+/components - where components are placed
+/config - where configuration files are to be stored
+/helpers - where all helpers are located
+/language - each language has its own directory in here
+ /en_us - the default language directory
+/lib - where all core minPHP files are located
+/plugins - where all minPHP plugins are stored
+/vendors - where vendor code is placed (i.e. third party libraries)
+</pre>
140 build.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="minPHP" default="build">
+ <target name="build"
+ depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,apigen,phpunit,phpcb"/>
+
+ <target name="build-parallel"
+ depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
+
+ <target name="tools-parallel" description="Run tools in parallel">
+ <parallel threadCount="2">
+ <sequential>
+ <antcall target="pdepend"/>
+ <antcall target="phpmd-ci"/>
+ </sequential>
+ <antcall target="phpcpd"/>
+ <antcall target="phpcs-ci"/>
+ <antcall target="phploc"/>
+ <antcall target="apigen"/>
+ </parallel>
+ </target>
+
+ <target name="clean" description="Cleanup build artifacts">
+ <delete dir="${basedir}/build/api"/>
+ <delete dir="${basedir}/build/code-browser"/>
+ <delete dir="${basedir}/build/coverage"/>
+ <delete dir="${basedir}/build/logs"/>
+ <delete dir="${basedir}/build/pdepend"/>
+ </target>
+
+ <target name="prepare" depends="clean" description="Prepare for build">
+ <mkdir dir="${basedir}/build/api"/>
+ <mkdir dir="${basedir}/build/code-browser"/>
+ <mkdir dir="${basedir}/build/coverage"/>
+ <mkdir dir="${basedir}/build/logs"/>
+ <mkdir dir="${basedir}/build/pdepend"/>
+ <mkdir dir="${basedir}/build/apigen"/>
+ </target>
+
+ <target name="lint" description="Perform syntax check of sourcecode files">
+ <apply executable="php" failonerror="true">
+ <arg value="-l" />
+
+ <fileset dir="${basedir}/src">
+ <include name="**/*.php" />
+ <modified />
+ </fileset>
+
+ <fileset dir="${basedir}/tests">
+ <include name="**/*.php" />
+ <modified />
+ </fileset>
+ </apply>
+ </target>
+
+ <target name="phploc" description="Measure project size using PHPLOC">
+ <exec executable="phploc">
+ <arg value="--log-csv" />
+ <arg value="${basedir}/build/logs/phploc.csv" />
+ <arg path="${basedir}/src" />
+ </exec>
+ </target>
+
+ <target name="pdepend" description="Calculate software metrics using PHP_Depend">
+ <exec executable="pdepend">
+ <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
+ <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
+ <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
+ <arg path="${basedir}/src" />
+ </exec>
+ </target>
+
+ <target name="phpmd"
+ description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
+ <exec executable="phpmd">
+ <arg path="${basedir}/src" />
+ <arg value="text" />
+ <arg value="${basedir}/build/phpmd.xml" />
+ </exec>
+ </target>
+
+ <target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
+ <exec executable="phpmd">
+ <arg path="${basedir}/src" />
+ <arg value="xml" />
+ <arg value="${basedir}/build/phpmd.xml" />
+ <arg value="--reportfile" />
+ <arg value="${basedir}/build/logs/pmd.xml" />
+ </exec>
+ </target>
+
+ <target name="phpcs"
+ description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
+ <exec executable="phpcs">
+ <arg value="--standard=${basedir}/build/phpcs.xml" />
+ <arg path="${basedir}/src" />
+ </exec>
+ </target>
+
+ <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
+ <exec executable="phpcs" output="/dev/null">
+ <arg value="--report=checkstyle" />
+ <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
+ <arg value="--standard=${basedir}/build/phpcs.xml" />
+ <arg path="${basedir}/src" />
+ </exec>
+ </target>
+
+ <target name="phpcpd" description="Find duplicate code using PHPCPD">
+ <exec executable="phpcpd">
+ <arg value="--log-pmd" />
+ <arg value="${basedir}/build/logs/pmd-cpd.xml" />
+ <arg path="${basedir}/src" />
+ </exec>
+ </target>
+
+ <target name="phpunit" description="Run unit tests with PHPUnit">
+ <exec executable="phpunit" failonerror="true">
+ <arg line="-c ${basedir}/build/phpunit.xml" />
+ </exec>
+ </target>
+
+ <target name="apigen" description="Generate API documentation using apigen">
+ <exec executable="apigen">
+ <arg value="--config" />
+ <arg path="${basedir}/build/apigen.neon" />
+ </exec>
+ </target>
+
+ <target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
+ <exec executable="phpcb">
+ <arg value="--log" />
+ <arg path="${basedir}/build/logs" />
+ <arg value="--source" />
+ <arg path="${basedir}/src" />
+ <arg value="--output" />
+ <arg path="${basedir}/build/code-browser" />
+ </exec>
+ </target>
+</project>
@@ -0,0 +1,67 @@
+# Source file or directory to parse
+source: ../src/
+# Directory where to save the generated documentation
+destination: ./apigen/
+# List of allowed file extensions
+extensions: [php]
+# Mask to exclude file or directory from processing
+exclude:
+# Don't generate documentation for classes from file or directory with this mask
+skipDocPath:
+# Don't generate documentation for classes with this name prefix
+skipDocPrefix:
+# Character set of source files
+charset: auto
+# Main project name prefix
+main: minPHP
+
+# Title of generated documentation
+title: minPHP
+# Documentation base URL
+baseUrl:
+# Google Custom Search ID
+googleCseId:
+# Google Custom Search label
+googleCseLabel:
+# Google Analytics tracking code
+googleAnalytics:
+# Template config file
+templateConfig: '/Applications/MAMP/htdocs/apigen/templates/bootstrap/config.neon'
+# Grouping of classes
+groups: auto
+# List of allowed HTML tags in documentation
+allowedHtml: [b, i, a, ul, ol, li, p, br, var, samp, kbd, tt]
+# Element types for search input autocomplete
+autocomplete: [classes, constants, functions]
+
+# Generate documentation for methods and properties with given access level
+accessLevels: [public, protected, private]
+# Generate documentation for elements marked as internal and display internal documentation parts
+internal: No
+# Generate documentation for PHP internal classes
+php: Yes
+# Generate tree view of classes, interfaces and exceptions
+tree: Yes
+# Generate documentation for deprecated classes, methods, properties and constants
+deprecated: Yes
+# Generate documentation of tasks
+todo: No
+# Generate highlighted source code files
+sourceCode: Yes
+# Add a link to download documentation as a ZIP archive
+download: No
+# Save a checkstyle report of poorly documented elements into a file
+report: ./logs/apigen.txt
+
+# Wipe out the destination directory first
+wipeout: Yes
+# Don't display scanning and generating messages
+quiet: No
+# Display progressbars
+progressbar: Yes
+# Use colors
+colors: No
+# Check for update
+updateCheck: Yes
+# Display additional information in case of an error
+debug: No
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<checkstyle version="1.3.0">
+</checkstyle>
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PDepend>
+ <Packages/>
+ <Cycles/>
+</PDepend>
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites>
+ <testsuite name="ProjectName" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/>
+</testsuites>
@@ -0,0 +1,2 @@
+Lines of Code (LOC),Cyclomatic Complexity / Lines of Code,Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Namespaces,Interfaces,Traits,Classes,Abstract Classes,Concrete Classes,Average Class Length (NCLOC),Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods,Average Method Length (NCLOC),Cyclomatic Complexity / Number of Methods,Anonymous Functions,Functions,Constants,Global Constants,Class Constants
+2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd-cpd/>
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<pmd version="1.4.0" timestamp="2012-10-15T06:15:49+02:00">
+</pmd>
Oops, something went wrong.

0 comments on commit 7d9325b

Please sign in to comment.