This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Router is static class which serves for routing purposes and can be used in 2 modes: full-map and on-the-go modes. | |
* | |
* Reads request uri path from $_GET['_REQUEST_URI'] | |
*/ | |
class Router | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replaces jQuery element or its content temporarily with watch symbol of iconic font (icon-refresh) | |
* | |
* To be used with http://fortawesome.github.com | |
*/ | |
function replaceByWatch(el, replaceInnerContent) { | |
var watch = $icon('icon-refresh icon-spin') | |
if (replaceInnerContent) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Arr | |
{ | |
static function get($arr, $keys = null, $default = null) | |
{ | |
if (is_null($keys)) | |
return $arr; | |
foreach((array)$keys as $k) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Trait Lazy | |
* | |
* Allows for static and dynamic lazy initialization. | |
* NB. Include "use Lazy;" in every class you want this functionality, otherwise collision may happen if any of parents use Lazy. | |
* | |
* Example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.action-success { | |
position: absolute; | |
z-index: 1000; | |
color: green; | |
border: 1px dashed green; | |
background-color: rgba(255,255,255,0.5); | |
font-size: 14px; | |
padding: 2px 4px; | |
border-radius: 8px; | |
text-align: center; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Serves for routing purposes and can be used in 2 modes: | |
* 1. Build the full map and then process | |
* 2. Process on the go until a matched mapping is found | |
* | |
* Reads request uri path from $_GET['_REQUEST_URI'] | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegExp.escape = function (text) { | |
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); | |
} | |
if (!Math.sqr) { | |
Math.sqr = function (x) { | |
return x * x; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Autoload that works only with _ namespace | |
if (!spl_autoload_register(function ($class) { | |
if (substr($class, 0, 2) !== '_\\') | |
return; | |
$class = (string)str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 2)); | |
$file = ROOT_PATH . '/_core/' . $class . '.php'; | |
if (file_exists($file)) | |
include $file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Router: | |
R::route('GET|POST', '/ajax', '\_\web\Ajax::processAjaxCall'); | |
# Handler method: | |
static function processAjaxCall() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace _\lang; | |
trait Classes | |
{ | |
static function fullClassName() | |
{ | |
return __CLASS__; |