init
authorMichael Wallner <mike@php.net>
Tue, 26 Nov 2013 09:52:38 +0000 (10:52 +0100)
committerMichael Wallner <mike@php.net>
Tue, 26 Nov 2013 09:52:38 +0000 (10:52 +0100)
16 files changed:
.gitignore [new file with mode: 0644]
VERSION [new file with mode: 0644]
composer.json [new file with mode: 0644]
composer.lock [new file with mode: 0644]
mdref/RefListing.php [new file with mode: 0644]
mdref/controllers/AppController.php [new file with mode: 0644]
mdref/controllers/IndexController.php [new file with mode: 0644]
mdref/controllers/RefController.php [new file with mode: 0644]
mdref/views/index.phtml [new file with mode: 0644]
mdref/views/layout.phtml [new file with mode: 0644]
nbproject/project.properties [new file with mode: 0644]
nbproject/project.xml [new file with mode: 0644]
public/index.css [new file with mode: 0644]
public/index.js [new file with mode: 0644]
public/index.php [new file with mode: 0644]
refs/http [new symlink]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..14bc68c
--- /dev/null
@@ -0,0 +1 @@
+/nbproject/private/
\ No newline at end of file
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..a163131
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.1.0alpha
diff --git a/composer.json b/composer.json
new file mode 100644 (file)
index 0000000..2a36108
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "require": {
+        "m6w6/autocracy": "dev-master"
+    }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644 (file)
index 0000000..11a05e8
--- /dev/null
@@ -0,0 +1,65 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
+    ],
+    "hash": "0147473751b895f221e765fd6fb1fc2b",
+    "packages": [
+        {
+            "name": "m6w6/autocracy",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/m6w6/autocracy.git",
+                "reference": "b6830cfce3dc276bf67288a7c6bfe64ffd290e21"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/m6w6/autocracy/zipball/b6830cfce3dc276bf67288a7c6bfe64ffd290e21",
+                "reference": "b6830cfce3dc276bf67288a7c6bfe64ffd290e21",
+                "shasum": ""
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "http\\Controller": "lib"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-2-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Wallner",
+                    "email": "mike@php.net"
+                }
+            ],
+            "description": "http\\Controller preserves your autocracy",
+            "homepage": "http://github.com/m6w6/autocracy",
+            "keywords": [
+                "controller",
+                "http",
+                "pecl",
+                "pecl_http"
+            ],
+            "time": "2013-10-22 11:41:09"
+        }
+    ],
+    "packages-dev": [
+
+    ],
+    "aliases": [
+
+    ],
+    "minimum-stability": "stable",
+    "stability-flags": {
+        "m6w6/autocracy": 20
+    },
+    "platform": [
+
+    ],
+    "platform-dev": [
+
+    ]
+}
diff --git a/mdref/RefListing.php b/mdref/RefListing.php
new file mode 100644 (file)
index 0000000..542a3ff
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+class RefListing
+{
+       function __construct($dir) {
+               
+       }
+}
\ No newline at end of file
diff --git a/mdref/controllers/AppController.php b/mdref/controllers/AppController.php
new file mode 100644 (file)
index 0000000..cb09d8f
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+namespace controllers;
+
+use http\Controller\Action;
+
+abstract class AppController extends Action
+{
+       protected function init() {
+               parent::init();
+               
+               $this->payload->title = "mdref";
+               $this->payload->listing = 123;
+       }
+}
\ No newline at end of file
diff --git a/mdref/controllers/IndexController.php b/mdref/controllers/IndexController.php
new file mode 100644 (file)
index 0000000..771de9f
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+namespace controllers;
+
+class IndexController extends AppController
+{
+       function indexAction() {
+       }
+}
diff --git a/mdref/controllers/RefController.php b/mdref/controllers/RefController.php
new file mode 100644 (file)
index 0000000..da55bcd
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace controllers;
+
+class RefController extends AppController
+{
+       function indexAction() {
+               
+       }
+}
\ No newline at end of file
diff --git a/mdref/views/index.phtml b/mdref/views/index.phtml
new file mode 100644 (file)
index 0000000..b2d525b
--- /dev/null
@@ -0,0 +1 @@
+index
\ No newline at end of file
diff --git a/mdref/views/layout.phtml b/mdref/views/layout.phtml
new file mode 100644 (file)
index 0000000..69c9727
--- /dev/null
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+ <head>
+  <meta charset="utf-8">
+  <title><?= $title ?></title>
+  <base href="<?= $baseUrl ?>/">
+  <link rel="stylesheet" href="index.css">
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
+ </head>
+ <body>
+  <div class="sidebar">
+   <?= $listing ?>
+  </div>
+
+  <?= $content ?>
+
+  <div id="disqus_thread"></div>
+
+  <footer>
+   <ul>
+       <li><a href="https://github.com/m6w6/mdref">mdref-v<?php readfile("../VERSION")?></a></li>
+       <li><a href="LICENSE">&copy; <?= implode("-", array_unique([2013,idate("Y")]))?></a></li>
+   </ul>
+  </footer>
+  <script src="index.js"></script>
+ </body>
+</html>
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644 (file)
index 0000000..d37ef95
--- /dev/null
@@ -0,0 +1,7 @@
+include.path=${php.global.include.path}
+php.version=PHP_54
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=false
+web.root=.
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644 (file)
index 0000000..5dec217
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.php.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/php-project/1">
+            <name>mdref-autocracy.git</name>
+        </data>
+    </configuration>
+</project>
diff --git a/public/index.css b/public/index.css
new file mode 100644 (file)
index 0000000..a48ac00
--- /dev/null
@@ -0,0 +1,162 @@
+* { 
+       font-size: 99.9%;
+}
+
+body, code {
+       font-family: Inconsolata, Monospace, 'Courier New', Courier, monospace;
+}
+body {
+       font-size: 1.5em;
+       margin: 0;
+       padding: 0;
+       color: #3f3f3f;
+}
+
+body>* {
+       margin-left: 1em;
+}
+body>ul {
+       margin-left: 2em;
+}
+
+.sidebar {
+       font-size: .9em;
+       float: right;
+       background: #f0f0f0;
+       border-bottom-left-radius: 10px;
+       padding: 0;
+       width: auto;
+       padding-right: 1em;
+}
+.sidebar>ul {
+}
+.sidebar ul {
+       margin-left: 1em;
+       padding: 0;
+       list-style-type: none;
+}
+
+code { 
+       display: inline-block;
+       border-radius: 2px;
+       padding: 0px 2px 2px 2px;
+       background: #e0e0e0;
+       color: #606060;
+       box-shadow: 0 0 1px #999;
+}
+
+code code {
+       display: inline;
+       padding: 0;
+       background: transparent;
+       border: none;
+       box-shadow: none;
+}
+
+pre>code {
+       padding: 1em;
+}
+pre>code, pre>code code {
+       background: #333;
+       color: #eee;
+}
+
+p, pre {
+       margin: 1em 2em;
+}
+
+blockquote {
+       border-top: 1px solid #800000;
+       border-bottom: 1px solid #800000;
+       background: #ffe4e1;
+       margin: 2em 0;
+}
+
+ul {
+       margin-bottom: 2em;
+}
+li {
+       margin-bottom: .5em;
+}
+a, h1 code>a {
+       color: #2f4f4f;
+}
+a:hover {
+       text-decoration: none;
+}
+
+.var {
+       color: #800000;
+}
+.constant {
+       color: #2e8b57;
+}
+
+h1 {
+       line-height: 1.5;
+}
+h1 code {
+       font-weight: normal;
+       font-size: .9em;
+       line-height: 1.33;
+}
+
+footer, h1, li h3 {
+       background: #708090;
+       color: #f5f5dc;
+}
+
+footer, h1 {
+       margin: 0;
+       padding: 1em;
+}
+
+li h3 {
+       border-radius: 4px;
+       display: inline-block;
+       width: auto;
+       padding: .2em;
+       margin: .5em 0 0 0;
+}
+
+h1 .constant, pre>code .consant, li h3 .constant {
+       color: #98fb98;
+}
+
+h1 .var, pre>code .var, li h3 .var {
+       color: #f4a460;
+}
+
+footer a, h1 a, pre>code a, li h3 a {
+       color: #b0e0e6;
+}
+
+li h3 a {
+       text-decoration: none;
+}
+li h3 a:hover {
+       text-decoration: underline;
+}
+
+#disqus_thread {
+       margin-top: 8em;
+       margin-right: 2em;
+}
+
+footer {
+       font-size: smaller;
+       text-align: center;
+       clear: both;
+       margin-top: 8em;
+}
+
+footer ul {
+       margin: 0;
+       padding: 0;
+}
+
+footer li {
+       list-style-type: none;
+       display: inline-block;
+       margin: 0 1em;
+}
diff --git a/public/index.js b/public/index.js
new file mode 100644 (file)
index 0000000..e0f3ccf
--- /dev/null
@@ -0,0 +1,200 @@
+function log() {
+       // console.log.apply(console, arguments);
+}
+
+function is_constant(s) {
+       s = s.replace(/v\d+(_\d+)?$/, "");
+       if (s.length < 2) {
+               return false;
+       }
+       return s.toUpperCase(s) === s;
+}
+
+function is_variable(s) {
+       return s.substring(0,1) === "$";
+}
+
+var is_in_string = false;
+
+function type(s, nn) {
+       var i, j, t;
+       //log("type", s);
+       // nothing
+       if (!s.match(/[a-zA-Z]/)) {
+               return;
+       }
+       
+       switch (s) {
+       // types
+       case "void":
+       case "bool":
+       case "int":
+       case "float":
+       case "string":
+       case "resource":
+       case "array":
+       case "object":
+       case "callable":
+       case "mixed":
+       // Zend/SPL
+       case "stdClass":
+       case "Exception":
+       case "ErrorException":
+       case "RuntimeException":
+       case "UnexpectedValueException":
+       case "DomainException":
+       case "InvalidArgumentException":
+       case "BadMethodCallException":
+       case "Closure":
+       case "Generator":
+       case "Countable":
+       case "Serializable":
+       case "Traversable":
+       case "Iterator":
+       case "IteratorAggregate":
+       case "ArrayAccess":
+       case "ArrayObject":
+       case "ArrayIterator":
+       case "RecursiveArrayIterator":
+       case "SplObserver":
+       case "SplSubject":
+       case "SplObjectStorage":
+               return "<code>";
+               
+       // keywords
+       case "is":
+               if (nn !== "H1") {
+                       return;
+               }
+       case "extends":
+       case "implements":
+               if (nn === "H1") {
+                       return "<br>&nbsp;<em>";
+               }
+       case "class":
+       case "interface":
+       case "namespace":
+       case "public":
+       case "protected":
+       case "private":
+       case "static":
+       case "final":
+       case "abstract":
+       case "self":
+       case "parent":
+       // phrases
+       case "Optional":
+       case "optional":
+               return "<em>";
+       }
+       
+       // class members
+       if (-1 !== (i = s.indexOf("::"))) {
+               t = s.substring(i+2);
+               if (!is_constant(t) && !is_variable(t)) {
+                       // methods
+                       return "<a href=\"" + s.replace(/::|\\/g, "/") + "\">";
+               }
+       }
+       if (-1 !== (j = s.indexOf("\\")) && s.substr(j+1,1) !== "n") {
+               return "<a href=\"" + s.replace(/\\/g, "/").replace(/::|$/, "#") + "\">";
+       }
+       
+       switch (s.toLowerCase()) {
+       // variables
+       default:
+               if (!is_variable(s)) {
+                       break;
+               }
+       // special constants
+       case "null":
+       case "true":
+       case "false":
+               return "<span class=\"var\">";
+       }
+       
+       // constants
+       if (is_constant(s)) {
+               return "<span class=\"constant\">";
+       }
+}
+
+function node(s, nn) {
+       //log("node", s);
+       
+       var t;
+       
+       if ((t = type(s, nn))) {
+               return $(t).text(s);
+       }
+       return document.createTextNode(s);
+}
+function wrap(n, nn) {
+       var $n = $(n)
+       var a = [];
+
+       $n.text().split(/([^a-zA-Z0-9_\\\$:]+)/).forEach(function(v) {
+               a.push(node(v, nn));
+       });
+       $n.replaceWith(a);
+}
+function walk(i, e) {
+       log("walk", i, e);
+
+       $.each($.makeArray(e.childNodes), function(i, n) {
+               switch (n.nodeName) {
+               case "A":
+               case "BR":
+               case "HR":
+                       break;
+               case "#text":
+                       wrap(n, e.nodeName);
+                       break;
+               default:
+                       walk(-1, n);
+                       break;
+               }
+       });
+}
+
+function blink(c) {
+       var $c = $(c);
+       
+       $c.fadeOut("fast").queue(function(next) {
+               this.style.color = "red";
+               next();
+       }).fadeIn("fast").fadeOut("slow").queue(function(next) {
+               this.style.color = "";
+               next();
+       }).fadeIn("slow");
+}
+
+function hashchange() {
+       if (location.hash.length > 1) {
+               var hash = location.hash.substring(1);
+               var name = is_variable(hash) ? ".var" : ".constant";
+               var scrolled = false;
+               
+               $(name).each(hash.substring(hash.length-1) === "_" ? function(i, c) {
+                       if (c.textContent.substring(0, hash.length) === hash) {
+                               if (!scrolled) {
+                                       $(window).scrollTop($(c).offset().top - 100);
+                                       scrolled = true;
+                               }
+                               blink(c);
+                       }
+               } : function(i, c) {
+                       if (c.textContent === hash) {
+                               $(window).scrollTop($(c).offset().top - 100);
+                               blink(c);
+                               return false;
+                       }
+               });
+       }
+}
+
+$(function() {
+       $("h1,h2,h3,h4,h5,h6,p,li,code").each(walk);
+       $(window).on("hashchange", hashchange);
+       hashchange();
+});
diff --git a/public/index.php b/public/index.php
new file mode 100644 (file)
index 0000000..649bb0a
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+while (ob_get_level() && ob_end_clean());
+
+$loader = require __DIR__ . "/../vendor/autoload.php";
+/* @var $loader \Composer\Autoload\ClassLoader */
+$loader->add("controllers", __DIR__ . "/../mdref");
+
+use http\Controller;
+use http\Controller\Url;
+
+use http\Controller\Observer\Callback;
+use http\Controller\Observer\Params;
+use http\Controller\Observer\Action;
+use http\Controller\Observer\View;
+use http\Controller\Observer\Layout;
+
+
+$url = new Url;
+
+$ctl = new Controller;
+$ctl->setDependency("baseUrl", $url);
+
+$ctl->attach(new Params\Action);
+$ctl->attach(new Action(["controllerPrefix" => "controllers\\"]));
+$ctl->attach(new Callback(function(\http\Controller $ctl) use ($url) {
+       $ctl->getPayload()->baseUrl = $url;
+}));
+$ctl->attach(new View(["directory" => __DIR__ . "/../mdref/views"]));
+$ctl->attach(new Layout(["directory" => __DIR__ . "/../mdref/views"]));
+
+$response = $ctl->notify()->getResponse();
+$response->send();
diff --git a/refs/http b/refs/http
new file mode 120000 (symlink)
index 0000000..924216a
--- /dev/null
+++ b/refs/http
@@ -0,0 +1 @@
+../../mdref-http.git/
\ No newline at end of file