From 44c90b17a899d9dbac414ce972984c4ceacab18f Mon Sep 17 00:00:00 2001 From: Alorel Date: Tue, 27 Oct 2015 16:37:15 +0000 Subject: [PATCH] 1.3 --- CHANGELOG.md | 4 + apigen.neon | 2 +- composer.json | 3 + coverage/Alo.php.html | 664 +++++++++++++++++------- coverage/dashboard.html | 8 +- coverage/index.html | 10 +- docs/404.html | 6 +- docs/annotation-group-deprecated.html | 6 +- docs/annotation-group-todo.html | 6 +- docs/class-AloFramework.Common.Alo.html | 229 +++++++- docs/class-Traversable.html | 6 +- docs/index.html | 8 +- docs/namespace-AloFramework.Common.html | 6 +- docs/namespace-AloFramework.html | 6 +- docs/namespace-PHP.html | 6 +- docs/tree.html | 6 +- src/Alo.php | 209 +++++++- tests/AloTest.php | 15 + 18 files changed, 960 insertions(+), 240 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a120b0c..a352477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.3 # + +getUniqid(), asciiRand(), isRegularRequest() added + # 1.2 # Added unXss(), getFingerprint() and isTraversable() diff --git a/apigen.neon b/apigen.neon index 88bbdbf..954b1ce 100644 --- a/apigen.neon +++ b/apigen.neon @@ -10,7 +10,7 @@ charset: [utf-8] templateTheme: bootstrap # Title of generated documentation -title: 'AloFramework Common Components 1.2 API' +title: 'AloFramework Common Components 1.3 API' # Grouping of classes groups: auto diff --git a/composer.json b/composer.json index 7f1d686..dc72efd 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,9 @@ "require": { "php": ">=5.4" }, + "suggests": { + "ext-openssl": "Makes randomiser functions cryptographically secure" + }, "autoload": { "psr-4": { "AloFramework\\Common\\": "src" diff --git a/coverage/Alo.php.html b/coverage/Alo.php.html index c8a3001..075a6b5 100644 --- a/coverage/Alo.php.html +++ b/coverage/Alo.php.html @@ -57,7 +57,7 @@
100.00%
-
12 / 12
+
14 / 14
CRAP
@@ -66,7 +66,7 @@
100.00%
-
32 / 32
+
48 / 48
@@ -86,8 +86,8 @@
100.00%
-
12 / 12
- 25 +
15 / 15
+ 33
100.00% covered (success) @@ -95,11 +95,11 @@
100.00%
-
32 / 32
+
48 / 48
-  includeIfExists +  includeIfExists
100.00% covered (success) @@ -120,7 +120,49 @@ -  isIncludable +  asciiRand +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 4 +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
15 / 15
+ + + +  getUniqid +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 2 +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
0 / 0
+ + + +  isIncludable
100.00% covered (success) @@ -141,7 +183,7 @@ -  includeOnceIfExists +  includeOnceIfExists
100.00% covered (success) @@ -162,7 +204,28 @@ -  isCliRequest +  isCliRequest +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 2 +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ + + +  isRegularRequest
100.00% covered (success) @@ -183,7 +246,7 @@ -  get +  get
100.00% covered (success) @@ -204,7 +267,7 @@ -  nullget +  nullget
100.00% covered (success) @@ -225,7 +288,7 @@ -  ifnull +  ifnull
100.00% covered (success) @@ -246,7 +309,7 @@ -  ifundefined +  ifundefined
100.00% covered (success) @@ -267,7 +330,7 @@ -  isAjaxRequest +  isAjaxRequest
100.00% covered (success) @@ -288,7 +351,7 @@ -  getFingerprint +  getFingerprint
100.00% covered (success) @@ -309,7 +372,7 @@ -  isTraversable +  isTraversable
100.00% covered (success) @@ -330,7 +393,7 @@ -  unXss +  unXss
100.00% covered (success) @@ -364,187 +427,394 @@     /**      * Static common component container      * @author Art <a.molcanovas@gmail.com> -      * @since  1.2 getFingerprint(), isTraversable(), unXss() added<br/> -      *         1.1 ifundefined() added -      */ -     abstract class Alo { - -         /** -          * Includes a file if it exists -          * @author Art <a.molcanovas@gmail.com> +      * @since  1.3 getUniqid(), asciiRand(), isRegularRequest() added<br/> +      *         1.2 getFingerprint(), isTraversable(), unXss() added<br/> +      *         1.1 ifundefined() added +      */ +     abstract class Alo { + +         /** +          * Defines the ascii charset subset as "the entire set"          * -          * @param string $path Path to the file -          * -          * @return bool True if the file is found, false if not -          */ -         static function includeIfExists($path) { -             if (self::isIncludable($path)) { -                 include $path; - -                 return true; -             } +          * @var int +          */ +         const ASCII_ALL = 0; + +         /** +          * Defines the ascii charset subset as "only alphanumeric" +          * +          * @var int +          */ +         const ASCII_ALPHANUM = 1; -             return false; -         } - -         /** -          * Checks if the path is includable -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param string $path The path -          * -          * @return bool -          */ -         private static function isIncludable($path) { -             return file_exists($path) && is_file($path); -         } - -         /** -          * include_once() a file if it exists -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param string $path Path to the file -          * -          * @return bool True if the file is found, false if not -          */ -         static function includeOnceIfExists($path) { -             if (self::isIncludable($path)) { -                 include_once $path; - -                 return true; -             } - -             return false; -         } - -         /** -          * Checks if we're dealing with a CLI request -          * @author Art <a.molcanovas@gmail.com> -          * @return bool -          */ -         static function isCliRequest() { -             return PHP_SAPI == 'cli' || defined('STDIN'); -         } - -         /** -          * Returns $var if it's set, null if it's not -          * -          * @param mixed $var Reference to the variable -          * -          * @return mixed|null $var if it's set, null if it's not -          */ -         static function get(&$var) { -             return isset($var) ? $var : null; -         } - -         /** -          * Returns $var if it's set and evaluates as true (a non-empty string, non-0 int etc), null otherwise -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param mixed $var Reference to the variable -          * -          * @return mixed|null The var or null -          */ -         static function nullget(&$var) { -             return self::get($var) ? $var : null; -         } - -         /** -          * Returns $var if it's set $planB if it's not -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param mixed $var        Reference to the main variable -          * @param mixed $planB      What to return if $var isn't available -          * @param bool  $useNullget If set to true, will use self::nullget(), otherwise will use self::get() to -          *                          determinewhether $var is set -          * -          * @return mixed $var if available, $planB if not -          */ -         static function ifnull(&$var, $planB, $useNullget = false) { -             $v = $useNullget ? self::nullget($var) : self::get($var); - -             return $v !== null ? $v : $planB; -         } - -         /** -          * Returns the value of the constant with the name of $const if it's defined, $planB if it's not -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param string $const Constant name -          * @param mixed  $planB What to return if $const isn't defined -          * -          * @return mixed -          * @since  1.1 -          */ -         static function ifundefined($const, $planB) { -             return defined($const) ? constant($const) : $planB; -         } - -         /** -          * Checks if the request was made via AJAX -          * @author Art <a.molcanovas@gmail.com> -          * @return bool -          */ -         static function isAjaxRequest() { -             return self::get($_SERVER['HTTP_X_REQUESTED_WITH']) == 'XMLHttpRequest'; -         } - -         /** -          * Returns a hashed browser fingerprint -          * -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param string $hashAlgo Hash algorithm to use -          * -          * @return string -          * @since  1.2 -          */ -         static function getFingerprint($hashAlgo = 'sha256') { -             return hash($hashAlgo, -                         '#QramRAN7*s%6n%@x*53jVVPsnrz@5MY$49o^mhJ8HqY%3a09yJnSWg9lBl$O4CKUb&&S%EgYBjhUZEbhquw$keCjR6I%zMcA!Qr' . -                         self::get($_SERVER['HTTP_USER_AGENT']) . -                         'OE2%fWaZh4jfZPiNXKmHfUw6ok6Z0s#PInaFa8&o#xh#nVyaFaXHPUcv^2y579PnYr5AOs6Zqb!QTAZCgRR968*%QxKc^XNuYYM8' . -                         self::get($_SERVER['HTTP_DNT']) . -                         '%CwyJJ^GAooDl&o0mc%7zbWlD^6tWoNSN&m3cKxWLP8kiBqO!j2PM5wACzyOoa^t7AEJ#FlDT!BMtD$luy%2iZejMVzktaiftpg*' . -                         self::get($_SERVER['HTTP_ACCEPT_LANGUAGE']) . -                         'tep!uTwVXk1CedJq0osEI7p&XCxnC3ipGDWEpTXULEg8J!K1NJSxe4GPor$R3OOb**ZjzPN$$SOHe4ZDcQWQULdtT&XxP2!YYxZy'); -         } - -         /** -          * Checks if the variable is usable in a foreach loop -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param mixed $input The variable -          * -          * @return bool -          * @since  1.2 -          */ -         static function isTraversable($input) { -             return is_array($input) || $input instanceof Traversable; -         } - -         /** -          * Protects the input from cross-site scripting attacks -          * @author Art <a.molcanovas@gmail.com> -          * -          * @param string|array|Traversable $input The scalar input, or an array/Traversable -          * -          * @return string|array|Traversable The escaped string. If an array or traversable was passed on, the input -          * withall its applicable values escaped. -          * @since  1.2 -          */ -         static function unXss($input) { -             if (self::isTraversable($input)) { -                 foreach ($input as &$i) { -                     $i = self::unXss($i); -                 } -             } elseif (is_scalar($input)) { -                 $input = htmlspecialchars($input, ENT_QUOTES | ENT_HTML5); -             } - -             return $input; -         } -     } +         /** +          * Defines the ascii charset subset as "only non-alphanumeric" +          * +          * @var int +          */ +         const ASCII_NONALPHANUM = 2; + +         /** +          * Array of ASCII alphanumeric characters +          * +          * @var array +          */ +         private static $asciiAlphanum = ['a', +                                          'b', +                                          'c', +                                          'd', +                                          'e', +                                          'f', +                                          'g', +                                          'h', +                                          'i', +                                          'j', +                                          'k', +                                          'l', +                                          'm', +                                          'n', +                                          'o', +                                          'p', +                                          'q', +                                          'r', +                                          's', +                                          't', +                                          'u', +                                          'v', +                                          'w', +                                          'x', +                                          'y', +                                          'z', +                                          'A', +                                          'B', +                                          'C', +                                          'D', +                                          'E', +                                          'F', +                                          'G', +                                          'H', +                                          'I', +                                          'J', +                                          'K', +                                          'L', +                                          'M', +                                          'N', +                                          'O', +                                          'P', +                                          'Q', +                                          'R', +                                          'S', +                                          'T', +                                          'U', +                                          'V', +                                          'W', +                                          'X', +                                          'Y', +                                          'Z', +                                          0, +                                          1, +                                          2, +                                          3, +                                          4, +                                          5, +                                          6, +                                          7, +                                          8, +                                          9]; +         /** +          * The rest of the ASCII charset +          * +          * @var array +          */ +         private static $asciNonAlphanum = [' ', +                                            '!', +                                            '"', +                                            '#', +                                            '$', +                                            '%', +                                            '\'', +                                            '(', +                                            ')', +                                            '*', +                                            '+', +                                            ',', +                                            '.', +                                            '/', +                                            ':', +                                            ';', +                                            '<', +                                            '=', +                                            '>', +                                            '?', +                                            '@', +                                            '[', +                                            '\\', +                                            ']', +                                            '^', +                                            '_', +                                            '`', +                                            '-', +                                            '{', +                                            '|', +                                            '}', +                                            '~']; + +         /** +          * Includes a file if it exists +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string $path Path to the file +          * +          * @return bool True if the file is found, false if not +          */ +         static function includeIfExists($path) { +             if (self::isIncludable($path)) { +                 include $path; + +                 return true; +             } + +             return false; +         } + +         /** +          * Generates a string of random ASCII characters +          * +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param int $length The length of the string +          * @param int $subset Which subset to use - see class' ASCII_* constants +          * +          * @return string +          * @since  1.3 +          */ +         static function asciiRand($length, $subset = self::ASCII_ALL) { +             switch ($subset) { +                 case self::ASCII_ALPHANUM: +                     $subset = self::$asciiAlphanum; +                     break; +                 case self::ASCII_NONALPHANUM: +                     $subset = self::$asciNonAlphanum; +                     break; +                 default: +                     $subset = array_merge(self::$asciiAlphanum, self::$asciNonAlphanum); +             } + +             $count = count($subset) - 1; + +             $r = ''; + +             for ($i = 0; $i < $length; $i++) { +                 $r .= $subset[mt_rand(0, $count)]; +             } + +             return $r; +         } + +         /** +          * Generates a unique identifier +          * +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string $hash      Hash algorithm +          * @param string $prefix    Prefix for the identifier +          * @param int    $entropy   Number of pseudo bytes used in entropy +          * @param bool   $rawOutput When set to true, outputs raw binary data. false outputs lowercase hexits. +          * +          * @return string +          * @see    https://secure.php.net/manual/en/function.hash.php +          * @since  1.3 +          * @codeCoverageIgnore +          */ +         static function getUniqid($hash = 'sha256', $prefix = '', $entropy = 250, $rawOutput = false) { +             $str = mt_rand(PHP_INT_MIN, PHP_INT_MAX) . json_encode([$_COOKIE, +                                                                     $_REQUEST, +                                                                     $_FILES, +                                                                     $_ENV, +                                                                     $_GET, +                                                                     $_POST, +                                                                     $_SERVER]) . uniqid($prefix, true) . +                    self::asciiRand($entropy, self::ASCII_ALL); + +             if (function_exists('\openssl_random_pseudo_bytes')) { +                 $str .= \openssl_random_pseudo_bytes($entropy); +             } else { +                 trigger_error('The openssl extension is not enabled, therefore the unique ID is not ' . +                               'cryptographically secure.', +                               E_USER_WARNING); +             } + +             return hash($hash, $str, $rawOutput); +         } + +         /** +          * Checks if the path is includable +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string $path The path +          * +          * @return bool +          */ +         private static function isIncludable($path) { +             return file_exists($path) && is_file($path); +         } + +         /** +          * include_once() a file if it exists +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string $path Path to the file +          * +          * @return bool True if the file is found, false if not +          */ +         static function includeOnceIfExists($path) { +             if (self::isIncludable($path)) { +                 include_once $path; + +                 return true; +             } + +             return false; +         } + +         /** +          * Checks if we're dealing with a CLI request +          * @author Art <a.molcanovas@gmail.com> +          * @return bool +          */ +         static function isCliRequest() { +             return PHP_SAPI == 'cli' || defined('STDIN'); +         } + +         /** +          * Checks if the request is non-ajax and non-CLI +          * @author Art <a.molcanovas@gmail.com> +          * @return bool +          * @since  1.3 +          */ +         static function isRegularRequest() { +             return !self::isAjaxRequest() && !self::isCliRequest(); +         } + +         /** +          * Returns $var if it's set, null if it's not +          * +          * @param mixed $var Reference to the variable +          * +          * @return mixed|null $var if it's set, null if it's not +          */ +         static function get(&$var) { +             return isset($var) ? $var : null; +         } + +         /** +          * Returns $var if it's set and evaluates as true (a non-empty string, non-0 int etc), null otherwise +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param mixed $var Reference to the variable +          * +          * @return mixed|null The var or null +          */ +         static function nullget(&$var) { +             return self::get($var) ? $var : null; +         } + +         /** +          * Returns $var if it's set $planB if it's not +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param mixed $var        Reference to the main variable +          * @param mixed $planB      What to return if $var isn't available +          * @param bool  $useNullget If set to true, will use self::nullget(), otherwise will use self::get() to +          *                          determinewhether $var is set +          * +          * @return mixed $var if available, $planB if not +          */ +         static function ifnull(&$var, $planB, $useNullget = false) { +             $v = $useNullget ? self::nullget($var) : self::get($var); + +             return $v !== null ? $v : $planB; +         } + +         /** +          * Returns the value of the constant with the name of $const if it's defined, $planB if it's not +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string $const Constant name +          * @param mixed  $planB What to return if $const isn't defined +          * +          * @return mixed +          * @since  1.1 +          */ +         static function ifundefined($const, $planB) { +             return defined($const) ? constant($const) : $planB; +         } + +         /** +          * Checks if the request was made via AJAX +          * @author Art <a.molcanovas@gmail.com> +          * @return bool +          */ +         static function isAjaxRequest() { +             return self::get($_SERVER['HTTP_X_REQUESTED_WITH']) == 'XMLHttpRequest'; +         } + +         /** +          * Returns a hashed browser fingerprint +          * +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string $hashAlgo Hash algorithm to use +          * +          * @return string +          * @since  1.2 +          */ +         static function getFingerprint($hashAlgo = 'sha256') { +             return hash($hashAlgo, +                         '#QramRAN7*s%6n%@x*53jVVPsnrz@5MY$49o^mhJ8HqY%3a09yJnSWg9lBl$O4CKUb&&S%EgYBjhUZEbhquw$keCjR6I%zMcA!Qr' . +                         self::get($_SERVER['HTTP_USER_AGENT']) . +                         'OE2%fWaZh4jfZPiNXKmHfUw6ok6Z0s#PInaFa8&o#xh#nVyaFaXHPUcv^2y579PnYr5AOs6Zqb!QTAZCgRR968*%QxKc^XNuYYM8' . +                         self::get($_SERVER['HTTP_DNT']) . +                         '%CwyJJ^GAooDl&o0mc%7zbWlD^6tWoNSN&m3cKxWLP8kiBqO!j2PM5wACzyOoa^t7AEJ#FlDT!BMtD$luy%2iZejMVzktaiftpg*' . +                         self::get($_SERVER['HTTP_ACCEPT_LANGUAGE']) . +                         'tep!uTwVXk1CedJq0osEI7p&XCxnC3ipGDWEpTXULEg8J!K1NJSxe4GPor$R3OOb**ZjzPN$$SOHe4ZDcQWQULdtT&XxP2!YYxZy'); +         } + +         /** +          * Checks if the variable is usable in a foreach loop +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param mixed $input The variable +          * +          * @return bool +          * @since  1.2 +          */ +         static function isTraversable($input) { +             return is_array($input) || $input instanceof Traversable; +         } + +         /** +          * Protects the input from cross-site scripting attacks +          * @author Art <a.molcanovas@gmail.com> +          * +          * @param string|array|Traversable $input The scalar input, or an array/Traversable +          * +          * @return string|array|Traversable The escaped string. If an array or traversable was passed on, the input +          * withall its applicable values escaped. +          * @since  1.2 +          */ +         static function unXss($input) { +             if (self::isTraversable($input)) { +                 foreach ($input as &$i) { +                     $i = self::unXss($i); +                 } +             } elseif (is_scalar($input)) { +                 $input = htmlspecialchars($input, ENT_QUOTES | ENT_HTML5); +             } + +             return $input; +         } +     } @@ -557,7 +827,7 @@

Legend

Dead Code

- Generated by PHP_CodeCoverage 3.0.1 using PHP 5.6.14 and PHPUnit 5.0.8 at Tue Oct 27 15:49:44 GMT 2015. + Generated by PHP_CodeCoverage 3.0.1 using PHP 5.6.14 and PHPUnit 5.0.8 at Tue Oct 27 16:36:56 GMT 2015.

diff --git a/coverage/dashboard.html b/coverage/dashboard.html index df93c21..2ef620a 100644 --- a/coverage/dashboard.html +++ b/coverage/dashboard.html @@ -136,7 +136,7 @@

Project Risks

@@ -175,7 +175,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,12], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,15], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -225,7 +225,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[100,25,"Alo<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[100,33,"Alo<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -249,7 +249,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,2,"
Alo::includeIfExists<\/a>"],[100,2,"Alo::isIncludable<\/a>"],[100,2,"Alo::includeOnceIfExists<\/a>"],[100,2,"Alo::isCliRequest<\/a>"],[100,2,"Alo::get<\/a>"],[100,2,"Alo::nullget<\/a>"],[100,3,"Alo::ifnull<\/a>"],[100,2,"Alo::ifundefined<\/a>"],[100,1,"Alo::isAjaxRequest<\/a>"],[100,1,"Alo::getFingerprint<\/a>"],[100,2,"Alo::isTraversable<\/a>"],[100,4,"Alo::unXss<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[100,2,"Alo::includeIfExists<\/a>"],[100,4,"Alo::asciiRand<\/a>"],[100,2,"Alo::getUniqid<\/a>"],[100,2,"Alo::isIncludable<\/a>"],[100,2,"Alo::includeOnceIfExists<\/a>"],[100,2,"Alo::isCliRequest<\/a>"],[100,2,"Alo::isRegularRequest<\/a>"],[100,2,"Alo::get<\/a>"],[100,2,"Alo::nullget<\/a>"],[100,3,"Alo::ifnull<\/a>"],[100,2,"Alo::ifundefined<\/a>"],[100,1,"Alo::isAjaxRequest<\/a>"],[100,1,"Alo::getFingerprint<\/a>"],[100,2,"Alo::isTraversable<\/a>"],[100,4,"Alo::unXss<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/coverage/index.html b/coverage/index.html index c666846..1ac9995 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -49,7 +49,7 @@
100.00%
-
32 / 32
+
48 / 48
100.00% covered (success) @@ -57,7 +57,7 @@
100.00%
-
12 / 12
+
14 / 14
100.00% covered (success) @@ -77,7 +77,7 @@
100.00%
-
32 / 32
+
48 / 48
100.00% covered (success) @@ -85,7 +85,7 @@
100.00%
-
12 / 12
+
14 / 14
diff --git a/docs/404.html b/docs/404.html index 560eed7..945718a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,7 +4,7 @@ - Page not found | AloFramework Common Components 1.2 API + Page not found | AloFramework Common Components 1.3 API @@ -15,7 +15,7 @@
+
+ + + + + public static + string + + + + +
+ # + asciiRand( integer $length, integer $subset = AloFramework\Common\Alo::ASCII_ALL ) + +
+

Generates a string of random ASCII characters

+
+ + +
+ + + + + public static + string + + + + +
+ # + getUniqid( string $hash = 'sha256', string $prefix = '', integer $entropy = 250, boolean $rawOutput = false ) + +
+

Generates a unique identifier

+
+ +
@@ -251,6 +356,47 @@

Author

+
+
+ + + + + public static + boolean + + + + +
+ # + isRegularRequest( ) + +
+

Checks if the request is non-ajax and non-CLI

+
+ +
@@ -615,6 +761,81 @@

Since

+
+

Constants summary

+ + + + + + + + + + + + + + + + + + + +
integer + +ASCII_ALL + +
+

Defines the ascii charset subset as "the entire set"

+
+ + +
+
+ # + 0 +
+
integer + +ASCII_ALPHANUM + +
+

Defines the ascii charset subset as "only alphanumeric"

+
+ + +
+
+ # + 1 +
+
integer + +ASCII_NONALPHANUM + +
+

Defines the ascii charset subset as "only non-alphanumeric"

+
+ + +
+
+ # + 2 +
+
+
+ @@ -622,7 +843,7 @@

Since

diff --git a/docs/class-Traversable.html b/docs/class-Traversable.html index e54b6aa..1e08379 100644 --- a/docs/class-Traversable.html +++ b/docs/class-Traversable.html @@ -3,7 +3,7 @@ - Interface Traversable | AloFramework Common Components 1.2 API + Interface Traversable | AloFramework Common Components 1.3 API @@ -14,7 +14,7 @@