| 1 |
<?php |
| 2 |
/** |
| 3 |
* Php.php |
| 4 |
* |
| 5 |
* The Php class file. |
| 6 |
* |
| 7 |
* PHP versions 5 |
| 8 |
* |
| 9 |
* @author Alexander Schneider <alexanderschneider85@gmail.com> |
| 10 |
* @copyright 2008-2017 Alexander Schneider |
| 11 |
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 |
| 12 |
* @version SVN: $id$ |
| 13 |
* @link http://wordpress.org/extend/plugins/user-access-manager/ |
| 14 |
*/ |
| 15 |
namespace UserAccessManager\Wrapper; |
| 16 |
|
| 17 |
use UserAccessManager\Controller\Controller; |
| 18 |
|
| 19 |
/** |
| 20 |
* Class Php |
| 21 |
* |
| 22 |
* @package UserAccessManager\Wrapper |
| 23 |
*/ |
| 24 |
class Php |
| 25 |
{ |
| 26 |
/** |
| 27 |
* @see function_exists() |
| 28 |
* |
| 29 |
* @param string $functionName |
| 30 |
* |
| 31 |
* @return bool |
| 32 |
*/ |
| 33 |
public function functionExists($functionName) |
| 34 |
{ |
| 35 |
return function_exists($functionName); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* @see array_fill() |
| 40 |
* |
| 41 |
* @param int $startIndex |
| 42 |
* @param int $numberOfElements |
| 43 |
* @param mixed $value |
| 44 |
* |
| 45 |
* @return array |
| 46 |
*/ |
| 47 |
public function arrayFill($startIndex, $numberOfElements, $value) |
| 48 |
{ |
| 49 |
return array_fill($startIndex, $numberOfElements, $value); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* @see openssl_random_pseudo_bytes() |
| 54 |
* |
| 55 |
* @param $length |
| 56 |
* @param $strong |
| 57 |
* |
| 58 |
* @return string |
| 59 |
*/ |
| 60 |
public function opensslRandomPseudoBytes($length, &$strong) |
| 61 |
{ |
| 62 |
return openssl_random_pseudo_bytes($length, $strong); |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* @see unlink() |
| 67 |
* |
| 68 |
* @param string $filename |
| 69 |
* @param resource $context |
| 70 |
* |
| 71 |
* @return bool |
| 72 |
*/ |
| 73 |
public function unlink($filename, $context = null) |
| 74 |
{ |
| 75 |
return ($context !== null) ? unlink($filename, $context) : unlink($filename); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* @see ini_get() |
| 80 |
* |
| 81 |
* @param string $variableName |
| 82 |
* |
| 83 |
* @return string |
| 84 |
*/ |
| 85 |
public function iniGet($variableName) |
| 86 |
{ |
| 87 |
return ini_get($variableName); |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* @see set_time_limit() |
| 92 |
* |
| 93 |
* @param int $seconds |
| 94 |
* |
| 95 |
* @return bool |
| 96 |
*/ |
| 97 |
public function setTimeLimit($seconds) |
| 98 |
{ |
| 99 |
return set_time_limit($seconds); |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* @see fread() |
| 104 |
* |
| 105 |
* @param resource $handle |
| 106 |
* @param int $length |
| 107 |
* |
| 108 |
* @return bool|string |
| 109 |
*/ |
| 110 |
public function fread($handle, $length) |
| 111 |
{ |
| 112 |
return fread($handle, $length); |
| 113 |
} |
| 114 |
|
| 115 |
/** |
| 116 |
* @param Controller $controller |
| 117 |
* @param string $file |
| 118 |
*/ |
| 119 |
public function includeFile(Controller &$controller, $file) |
| 120 |
{ |
| 121 |
/** @noinspection PhpIncludeInspection */ |
| 122 |
include $file; |
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* @see exit() |
| 127 |
*/ |
| 128 |
public function callExit() |
| 129 |
{ |
| 130 |
exit; |
| 131 |
} |
| 132 |
} |
| 133 |
|