commit
88ee67af72
105 changed files with 22934 additions and 0 deletions
@ -0,0 +1,243 @@
|
||||
<?php |
||||
/** |
||||
* PHPLib |
||||
* |
||||
* A PHP library to wrap php functions in a standard fashion |
||||
* |
||||
* @package PHPLib |
||||
* @author Timothy J. Warren |
||||
* @copyright Copyright (c) 2013 |
||||
* @link https://github.com/aviat4ion/PHPLib |
||||
* @license MIT |
||||
*/ |
||||
|
||||
// -------------------------------------------------------------------------- |
||||
|
||||
namespace PHPUtil; |
||||
|
||||
/** |
||||
* Wrapper over array functions with a consistent interface |
||||
*/ |
||||
class Arr { |
||||
|
||||
/** |
||||
* Original array to manipulate |
||||
* @var array |
||||
*/ |
||||
protected $original; |
||||
|
||||
/** |
||||
* Constructor |
||||
* |
||||
* @param array $arr |
||||
* @return Arr |
||||
*/ |
||||
public function __construct($arr) |
||||
{ |
||||
$this->original = $arr; |
||||
} |
||||
|
||||
/** |
||||
* Enable using the object as a function |
||||
* |
||||
* @param string $arr |
||||
* @return $this |
||||
*/ |
||||
public function __invoke($arr) |
||||
{ |
||||
$this->__construct($arr); |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Return the keys or a subset of the keys of an array |
||||
* |
||||
* @see http://php.net/manual/function.array-keys.php |
||||
* @param mixed $search_value |
||||
* @param bool $strict |
||||
* @return array |
||||
*/ |
||||
public function keys($search_value=NULL, $strict=FALSE) |
||||
{ |
||||
return array_keys($this->original, $search_value, $strict); |
||||
} |
||||
|
||||
/** |
||||
* Returns the values from the input array with a numeric index |
||||
* |
||||
* @return array |
||||
*/ |
||||
public function values() |
||||
{ |
||||
return array_values($this->original); |
||||
} |
||||
|
||||
/** |
||||
* Returns an array of elements from the input array that match the |
||||
* specified pattern |
||||
* |
||||
* @param mixed $pattern |
||||
* @param mixed $invert |
||||
* @return array |
||||
*/ |
||||
public function grep($pattern, $invert=FALSE) |
||||
{ |
||||
$flags = ($invert == TRUE) ? PREG_GREP_INVERT : 0; |
||||
|
||||
return preg_grep($pattern, $this->original, $flags); |
||||
} |
||||
|
||||
/** |
||||
* Replace elements in the main array with the values in the passed arrays |
||||
* (Takes a variable number of arguments) |
||||
* |
||||
* @see http://php.net/manual/function.array-replace.php |
||||
* @return array |
||||
*/ |
||||
public function replace() |
||||
{ |
||||
$args = func_get_args(); |
||||
array_unshift($args, $this->original); |
||||
|
||||
return call_user_func_array('array_replace', $args); |
||||
} |
||||
|
||||
/** |
||||
* Combine arrays |
||||
* (Takes a variable number of arguments) |
||||
* |
||||
* @see http://php.net/manual/function.array-merge.php |
||||
* @return array |
||||
*/ |
||||
public function merge() |
||||
{ |
||||
$args = func_get_args(); |
||||
array_unshift($args, $this->original); |
||||
|
||||
return call_user_func_array('array_merge', $args); |
||||
} |
||||
|
||||
/** |
||||
* Return a new array from the original with duplicate items removed |
||||
* |
||||
* @see http://php.net/manual/function.array-unique.php |
||||
* @param |
||||
* @return array |
||||
*/ |
||||
public function unique($sort_flags=SORT_STRING) |
||||
{ |
||||
return array_unique($this->original, $sort_flags); |
||||
} |
||||
|
||||
/** |
||||
* Return an array with elements having the defined values |
||||
* |
||||
* @see http://php.net/manual/function.array-fill.php |
||||
* @param int $start_index |
||||
* @param int $num |
||||
* @param mixed $value |
||||
* @return array |
||||
*/ |
||||
public function fill($start_index, $num, $value) |
||||
{ |
||||
return array_file($start_index, $num, $value); |
||||
} |
||||
|
||||
/** |
||||
* Lengthen array to $pad_length with $pad_value |
||||
* |
||||
* @see http://php.net/manual/function.array-pad.php |
||||
* @param int $pad_size |
||||
* @param mixed $pad_value |
||||
* @return array |
||||
*/ |
||||
public function pad($pad_size, $pad_value) |
||||
{ |
||||
return array_pad($this->original, $pad_size, $pad_value); |
||||
} |
||||
|
||||
/** |
||||
* Return an array with keys that are the values of the input |
||||
* array, and values as the frequency of those values |
||||
* |
||||
* @see http://php.net/manual/function.array-count-values.php |
||||
* @return array |
||||
*/ |
||||
public function count_values() |
||||
{ |
||||
return array_count_values($this->original); |
||||
} |
||||
|
||||
/** |
||||
* Return an array with keys and values reversed from the input array |
||||
* |
||||
* @see http://php.net/manual/function.array-flip.php |
||||
* @return array |
||||
*/ |
||||
public function flip() |
||||
{ |
||||
return array_flip($this->original); |
||||
} |
||||
|
||||
/** |
||||
* Returns the sum of all the values in the array |
||||
* |
||||
* @see http://php.net/manual/function.array-sum.php |
||||
* @return number |
||||
*/ |
||||
public function sum() |
||||
{ |
||||
return array_sum($this->original); |
||||
} |
||||
|
||||
/** |
||||
* Return a sorted array |
||||
* |
||||
* @see http://php.net/manual/function.asort.php |
||||
* @param int $sort_flags |
||||
* @return array |
||||
*/ |
||||
public function sort($sort_flags=SORT_REGULAR) |
||||
{ |
||||
asort($this->original, $sort_flags); |
||||
return $this->original; |
||||
} |
||||
|
||||
/** |
||||
* Return a reverse-sorted array |
||||
* |
||||
* @see http://php.net/manual/function.asort.php |
||||
* @param int $sort_flags |
||||
* @return array |
||||
*/ |
||||
public function reverse_sort($sort_flags=SORT_REGULAR) |
||||
{ |
||||
rsort($this->original, $sort_flags); |
||||
return $this->original; |
||||
} |
||||
|
||||
/** |
||||
* Reverse the order of the array |
||||
* |
||||
* @see http://php.net/manual/function.array-reverse.php |
||||
* @param bool $preserve_keys |
||||
* @return array |
||||
*/ |
||||
public function reverse($preserve_keys=FALSE) |
||||
{ |
||||
return array_reverse($this->original, $preserve_keys); |
||||
} |
||||
|
||||
/** |
||||
* Filter elements of the input array using a callback function |
||||
* |
||||
* @see http://php.net/manual/function.array-filter.php |
||||
* @param callable $callback |
||||
* @return array |
||||
*/ |
||||
public function filter(callable $callback=NULL) |
||||
{ |
||||
return array_filter($this->original, $callback); |
||||
} |
||||
} |
||||
// End of arr.php |
@ -0,0 +1,567 @@
|
||||
/*! |
||||
* Bootstrap Responsive v2.0.0 |
||||
* |
||||
* Copyright 2012 Twitter, Inc |
||||
* Licensed under the Apache License v2.0 |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Designed and built with all the love in the world @twitter by @mdo and @fat. |
||||
*/ |
||||
.hidden { |
||||
display: none; |
||||
visibility: hidden; |
||||
} |
||||
@media (max-width: 480px) { |
||||
.nav-collapse { |
||||
-webkit-transform: translate3d(0, 0, 0); |
||||
} |
||||
.page-header h1 small { |
||||
display: block; |
||||
line-height: 18px; |
||||
} |
||||
input[class*="span"], |
||||
select[class*="span"], |
||||
textarea[class*="span"], |
||||
.uneditable-input { |
||||
display: block; |
||||
width: 100%; |
||||
height: 28px; |
||||
/* Make inputs at least the height of their button counterpart */ |
||||
|
||||
/* Makes inputs behave like true block-level elements */ |
||||
|
||||
-webkit-box-sizing: border-box; |
||||
/* Older Webkit */ |
||||
|
||||
-moz-box-sizing: border-box; |
||||
/* Older FF */ |
||||
|
||||
-ms-box-sizing: border-box; |
||||
/* IE8 */ |
||||
|
||||
box-sizing: border-box; |
||||
/* CSS3 spec*/ |
||||
|
||||
} |
||||
.input-prepend input[class*="span"], .input-append input[class*="span"] { |
||||
width: auto; |
||||
} |
||||
input[type="checkbox"], input[type="radio"] { |
||||
border: 1px solid #ccc; |
||||
} |
||||
.form-horizontal .control-group > label { |
||||
float: none; |
||||
width: auto; |
||||
padding-top: 0; |
||||
text-align: left; |
||||
} |
||||
.form-horizontal .controls { |
||||
margin-left: 0; |
||||
} |
||||
.form-horizontal .control-list { |
||||
padding-top: 0; |
||||
} |
||||
.form-horizontal .form-actions { |
||||
padding-left: 10px; |
||||
padding-right: 10px; |
||||
} |
||||
.modal { |
||||
position: absolute; |
||||
top: 10px; |
||||
left: 10px; |
||||
right: 10px; |
||||
width: auto; |
||||
margin: 0; |
||||
} |
||||
.modal.fade.in { |
||||
top: auto; |
||||
} |
||||
.modal-header .close { |
||||
padding: 10px; |
||||
margin: -10px; |
||||
} |
||||
.carousel-caption { |
||||
position: static; |
||||
} |
||||
} |
||||
@media (max-width: 768px) { |
||||
.container { |
||||
width: auto; |
||||
padding: 0 20px; |
||||
} |
||||
.row-fluid { |
||||
width: 100%; |
||||
} |
||||
.row { |
||||
margin-left: 0; |
||||
} |
||||
.row > [class*="span"], .row-fluid > [class*="span"] { |
||||
float: none; |
||||
display: block; |
||||
width: auto; |
||||
margin: 0; |
||||
} |
||||
} |
||||
@media (min-width: 768px) and (max-width: 980px) { |
||||
.row { |
||||
margin-left: -20px; |
||||
*zoom: 1; |
||||
} |
||||
.row:before, .row:after { |
||||
display: table; |
||||
content: ""; |
||||
} |
||||
.row:after { |
||||
clear: both; |
||||
} |
||||
[class*="span"] { |
||||
float: left; |
||||
margin-left: 20px; |
||||
} |
||||
.span1 { |
||||
width: 42px; |
||||
} |
||||
.span2 { |
||||
width: 104px; |
||||
} |
||||
.span3 { |
||||
width: 166px; |
||||
} |
||||
.span4 { |
||||
width: 228px; |
||||
} |
||||
.span5 { |
||||
width: 290px; |
||||
} |
||||
.span6 { |
||||
width: 352px; |
||||
} |
||||
.span7 { |
||||
width: 414px; |
||||
} |
||||
.span8 { |
||||
width: 476px; |
||||
} |
||||
.span9 { |
||||
width: 538px; |
||||
} |
||||
.span10 { |
||||
width: 600px; |
||||
} |
||||
.span11 { |
||||
width: 662px; |
||||
} |
||||
.span12, .container { |
||||
width: 724px; |
||||
} |
||||
.offset1 { |
||||
margin-left: 82px; |
||||
} |
||||
.offset2 { |
||||
margin-left: 144px; |
||||
} |
||||
.offset3 { |
||||
margin-left: 206px; |
||||
} |
||||
.offset4 { |
||||
margin-left: 268px; |
||||
} |
||||
.offset5 { |
||||
margin-left: 330px; |
||||
} |
||||
.offset6 { |
||||
margin-left: 392px; |
||||
} |
||||
.offset7 { |
||||
margin-left: 454px; |
||||
} |
||||
.offset8 { |
||||
margin-left: 516px; |
||||
} |
||||
.offset9 { |
||||
margin-left: 578px; |
||||
} |
||||
.offset10 { |
||||
margin-left: 640px; |
||||
} |
||||
.offset11 { |
||||
margin-left: 702px; |
||||
} |
||||
.row-fluid { |
||||
width: 100%; |
||||
*zoom: 1; |
||||
} |
||||
.row-fluid:before, .row-fluid:after { |
||||
display: table; |
||||
content: ""; |
||||
} |
||||
.row-fluid:after { |
||||
clear: both; |
||||
} |
||||
.row-fluid > [class*="span"] { |
||||
float: left; |
||||
margin-left: 2.762430939%; |
||||
} |
||||
.row-fluid > [class*="span"]:first-child { |
||||
margin-left: 0; |
||||
} |
||||
.row-fluid .span1 { |
||||
width: 5.801104972%; |
||||
} |
||||
.row-fluid .span2 { |
||||
width: 14.364640883%; |
||||
} |
||||
.row-fluid .span3 { |
||||
width: 22.928176794%; |
||||
} |
||||
.row-fluid .span4 { |
||||
width: 31.491712705%; |
||||
} |
||||
.row-fluid .span5 { |
||||
width: 40.055248616%; |
||||
} |
||||
.row-fluid .span6 { |
||||
width: 48.618784527%; |
||||
} |
||||
.row-fluid .span7 { |
||||
width: 57.182320438000005%; |
||||
} |
||||
.row-fluid .span8 { |
||||
width: 65.74585634900001%; |
||||
} |
||||
.row-fluid .span9 { |
||||
width: 74.30939226%; |
||||
} |
||||
.row-fluid .span10 { |
||||
width: 82.87292817100001%; |
||||
} |
||||
.row-fluid .span11 { |
||||
width: 91.436464082%; |
||||
} |
||||
.row-fluid .span12 { |
||||
width: 99.999999993%; |
||||
} |
||||
input.span1, textarea.span1, .uneditable-input.span1 { |
||||
width: 32px; |
||||
} |
||||
input.span2, textarea.span2, .uneditable-input.span2 { |
||||
width: 94px; |
||||
} |
||||