PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/PHP/CompatInfo/Reference/mcrypt.php

http://github.com/llaville/php-compat-info
PHP | 290 lines | 195 code | 13 blank | 82 comment | 32 complexity | 1050681d6a221022aad00caeef53220a MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Version informations about mcrypt extension
  4. *
  5. * PHP version 5
  6. *
  7. * @category PHP
  8. * @package PHP_CompatInfo
  9. * @author Remi Collet <Remi@FamilleCollet.com>
  10. * @license http://www.opensource.org/licenses/bsd-license.php BSD License
  11. * @version SVN: $Id$
  12. * @link http://php5.laurent-laville.org/compatinfo/
  13. */
  14. /**
  15. * All interfaces, classes, functions, constants about mcrypt extension
  16. *
  17. * @category PHP
  18. * @package PHP_CompatInfo
  19. * @author Remi Collet <Remi@FamilleCollet.com>
  20. * @license http://www.opensource.org/licenses/bsd-license.php BSD License
  21. * @version Release: @package_version@
  22. * @link http://php5.laurent-laville.org/compatinfo/
  23. * @link http://www.php.net/manual/en/book.mcrypt.php
  24. */
  25. class PHP_CompatInfo_Reference_Mcrypt implements PHP_CompatInfo_Reference
  26. {
  27. /**
  28. * Gets all informations at once about:
  29. * extensions, interfaces, classes, functions, constants
  30. *
  31. * @param string $extension OPTIONAL
  32. * @param string $version OPTIONAL PHP version
  33. * (4 => only PHP4, 5 or null => PHP4 + PHP5)
  34. *
  35. * @return array
  36. */
  37. public function getAll($extension = null, $version = null)
  38. {
  39. $references = array(
  40. 'extensions' => $this->getExtensions($extension, $version),
  41. 'interfaces' => $this->getInterfaces($extension, $version),
  42. 'classes' => $this->getClasses($extension, $version),
  43. 'functions' => $this->getFunctions($extension, $version),
  44. 'constants' => $this->getConstants($extension, $version),
  45. );
  46. return $references;
  47. }
  48. /**
  49. * Gets informations about extensions
  50. *
  51. * @param string $extension OPTIONAL
  52. * @param string $version OPTIONAL PHP version
  53. * (4 => only PHP4, 5 or null => PHP4 + PHP5)
  54. *
  55. * @return array
  56. */
  57. public function getExtensions($extension = null, $version = null)
  58. {
  59. $extensions = array(
  60. 'mcrypt' => array('4.0.0', '', '')
  61. );
  62. return $extensions;
  63. }
  64. /**
  65. * Gets informations about interfaces
  66. *
  67. * @param string $extension OPTIONAL
  68. * @param string $version OPTIONAL PHP version
  69. * (4 => only PHP4, 5 or null => PHP4 + PHP5)
  70. *
  71. * @return array
  72. */
  73. public function getInterfaces($extension = null, $version = null)
  74. {
  75. $interfaces = array();
  76. if ((null == $version ) || ('4' == $version)) {
  77. $version4 = array(
  78. );
  79. $interfaces = array_merge(
  80. $interfaces,
  81. $version4
  82. );
  83. }
  84. if ((null == $version ) || ('5' == $version)) {
  85. $version5 = array(
  86. );
  87. $interfaces = array_merge(
  88. $interfaces,
  89. $version5
  90. );
  91. }
  92. return $interfaces;
  93. }
  94. /**
  95. * Gets informations about classes
  96. *
  97. * @param string $extension OPTIONAL
  98. * @param string $version OPTIONAL PHP version
  99. * (4 => only PHP4, 5 or null => PHP4 + PHP5)
  100. *
  101. * @return array
  102. */
  103. public function getClasses($extension = null, $version = null)
  104. {
  105. $classes = array();
  106. if ((null == $version ) || ('4' == $version)) {
  107. $version4 = array(
  108. );
  109. $classes = array_merge(
  110. $classes,
  111. $version4
  112. );
  113. }
  114. if ((null == $version ) || ('5' == $version)) {
  115. $version5 = array(
  116. );
  117. $classes = array_merge(
  118. $classes,
  119. $version5
  120. );
  121. }
  122. return $classes;
  123. }
  124. /**
  125. * Gets informations about functions
  126. *
  127. * @param string $extension OPTIONAL
  128. * @param string $version OPTIONAL PHP version
  129. * (4 => only PHP4, 5 or null => PHP4 + PHP5)
  130. *
  131. * @return array
  132. * @link http://www.php.net/manual/en/ref.mcrypt.php
  133. */
  134. public function getFunctions($extension = null, $version = null)
  135. {
  136. $functions = array();
  137. if ((null == $version ) || ('4' == $version)) {
  138. $version4 = array(
  139. 'mcrypt_cbc' => array('4.0.0', ''),
  140. 'mcrypt_cfb' => array('4.0.0', ''),
  141. 'mcrypt_create_iv' => array('4.0.0', ''),
  142. 'mcrypt_decrypt' => array('4.0.2', ''),
  143. 'mcrypt_ecb' => array('4.0.0', ''),
  144. 'mcrypt_enc_get_algorithms_name' => array('4.0.2', ''),
  145. 'mcrypt_enc_get_block_size' => array('4.0.2', ''),
  146. 'mcrypt_enc_get_iv_size' => array('4.0.2', ''),
  147. 'mcrypt_enc_get_key_size' => array('4.0.2', ''),
  148. 'mcrypt_enc_get_modes_name' => array('4.0.2', ''),
  149. 'mcrypt_enc_get_supported_key_sizes' => array('4.0.2', ''),
  150. 'mcrypt_enc_is_block_algorithm_mode' => array('4.0.2', ''),
  151. 'mcrypt_enc_is_block_algorithm' => array('4.0.2', ''),
  152. 'mcrypt_enc_is_block_mode' => array('4.0.2', ''),
  153. 'mcrypt_enc_self_test' => array('4.0.2', ''),
  154. 'mcrypt_encrypt' => array('4.0.2', ''),
  155. 'mcrypt_generic_deinit' => array('4.0.7', ''),
  156. // Function in php < 5.2, alias after
  157. 'mcrypt_generic_end' => array('4.0.2', ''),
  158. 'mcrypt_generic_init' => array('4.0.2', ''),
  159. 'mcrypt_generic' => array('4.0.2', ''),
  160. 'mcrypt_get_block_size' => array('4.0.0', ''),
  161. 'mcrypt_get_cipher_name' => array('4.0.0', ''),
  162. 'mcrypt_get_iv_size' => array('4.0.2', ''),
  163. 'mcrypt_get_key_size' => array('4.0.0', ''),
  164. 'mcrypt_list_algorithms' => array('4.0.2', ''),
  165. 'mcrypt_list_modes' => array('4.0.2', ''),
  166. 'mcrypt_module_close' => array('4.0.2', ''),
  167. 'mcrypt_module_get_algo_block_size' => array('4.0.2', ''),
  168. 'mcrypt_module_get_algo_key_size' => array('4.0.2', ''),
  169. 'mcrypt_module_get_supported_key_sizes' => array('4.0.2', ''),
  170. 'mcrypt_module_is_block_algorithm_mode' => array('4.0.2', ''),
  171. 'mcrypt_module_is_block_algorithm' => array('4.0.2', ''),
  172. 'mcrypt_module_is_block_mode' => array('4.0.2', ''),
  173. 'mcrypt_module_open' => array('4.0.2', ''),
  174. 'mcrypt_module_self_test' => array('4.0.2', ''),
  175. 'mcrypt_ofb' => array('4.0.0', ''),
  176. 'mdecrypt_generic' => array('4.0.2', ''),
  177. );
  178. $functions = array_merge(
  179. $functions,
  180. $version4
  181. );
  182. }
  183. if ((null == $version ) || ('5' == $version)) {
  184. $version5 = array(
  185. );
  186. $functions = array_merge(
  187. $functions,
  188. $version5
  189. );
  190. }
  191. return $functions;
  192. }
  193. /**
  194. * Gets informations about constants
  195. *
  196. * @param string $extension OPTIONAL
  197. * @param string $version OPTIONAL PHP version
  198. * (4 => only PHP4, 5 or null => PHP4 + PHP5)
  199. *
  200. * @return array
  201. * @link http://www.php.net/manual/fr/mcrypt.constants.php
  202. * @link http://www.php.net/manual/fr/mcrypt.ciphers.php
  203. */
  204. public function getConstants($extension = null, $version = null)
  205. {
  206. $constants = array();
  207. if ((null == $version ) || ('4' == $version)) {
  208. $version4 = array(
  209. 'MCRYPT_MODE_ECB' => array('4.0.0', ''),
  210. 'MCRYPT_MODE_CBC' => array('4.0.0', ''),
  211. 'MCRYPT_MODE_CFB' => array('4.0.0', ''),
  212. 'MCRYPT_MODE_OFB' => array('4.0.0', ''),
  213. 'MCRYPT_MODE_NOFB' => array('4.0.0', ''),
  214. 'MCRYPT_MODE_STREAM' => array('4.0.0', ''),
  215. 'MCRYPT_ENCRYPT' => array('4.0.0', ''),
  216. 'MCRYPT_DECRYPT' => array('4.0.0', ''),
  217. 'MCRYPT_DEV_RANDOM' => array('4.0.0', ''),
  218. 'MCRYPT_DEV_URANDOM' => array('4.0.0', ''),
  219. 'MCRYPT_RAND' => array('4.0.0', ''),
  220. 'MCRYPT_3DES' => array('4.0.0', ''),
  221. 'MCRYPT_ARCFOUR_IV' => array('4.0.0', ''),
  222. 'MCRYPT_ARCFOUR' => array('4.0.0', ''),
  223. 'MCRYPT_BLOWFISH' => array('4.0.0', ''),
  224. 'MCRYPT_CAST_128' => array('4.0.0', ''),
  225. 'MCRYPT_CAST_256' => array('4.0.0', ''),
  226. 'MCRYPT_CRYPT' => array('4.0.0', ''),
  227. 'MCRYPT_DES' => array('4.0.0', ''),
  228. 'MCRYPT_DES_COMPAT' => array('4.0.0', ''),
  229. 'MCRYPT_ENIGNA' => array('4.0.0', ''),
  230. 'MCRYPT_GOST' => array('4.0.0', ''),
  231. 'MCRYPT_IDEA' => array('4.0.0', ''),
  232. 'MCRYPT_LOKI97' => array('4.0.0', ''),
  233. 'MCRYPT_MARS' => array('4.0.0', ''),
  234. 'MCRYPT_PANAMA' => array('4.0.0', ''),
  235. 'MCRYPT_RIJNDAEL_128' => array('4.0.0', ''),
  236. 'MCRYPT_RIJNDAEL_192' => array('4.0.0', ''),
  237. 'MCRYPT_RIJNDAEL_256' => array('4.0.0', ''),
  238. 'MCRYPT_RC2' => array('4.0.0', ''),
  239. 'MCRYPT_RC4' => array('4.0.0', ''),
  240. 'MCRYPT_RC6' => array('4.0.0', ''),
  241. 'MCRYPT_RC6_128' => array('4.0.0', ''),
  242. 'MCRYPT_RC6_192' => array('4.0.0', ''),
  243. 'MCRYPT_RC6_256' => array('4.0.0', ''),
  244. 'MCRYPT_SAFER64' => array('4.0.0', ''),
  245. 'MCRYPT_SAFER128' => array('4.0.0', ''),
  246. 'MCRYPT_SAFERPLUS' => array('4.0.0', ''),
  247. 'MCRYPT_SERPENT' => array('4.0.0', ''),
  248. 'MCRYPT_SERPENT_128' => array('4.0.0', ''),
  249. 'MCRYPT_SERPENT_192' => array('4.0.0', ''),
  250. 'MCRYPT_SERPENT_256' => array('4.0.0', ''),
  251. 'MCRYPT_SKIPJACK' => array('4.0.0', ''),
  252. 'MCRYPT_TEAN' => array('4.0.0', ''),
  253. 'MCRYPT_THREEWAY' => array('4.0.0', ''),
  254. 'MCRYPT_TRIPLEDES' => array('4.0.0', ''),
  255. 'MCRYPT_TWOFISH' => array('4.0.0', ''),
  256. 'MCRYPT_TWOFISH128' => array('4.0.0', ''),
  257. 'MCRYPT_TWOFISH192' => array('4.0.0', ''),
  258. 'MCRYPT_TWOFISH256' => array('4.0.0', ''),
  259. 'MCRYPT_WAKE' => array('4.0.0', ''),
  260. 'MCRYPT_XTEA' => array('4.0.0', ''),
  261. );
  262. $constants = array_merge(
  263. $constants,
  264. $version4
  265. );
  266. }
  267. if ((null == $version ) || ('5' == $version)) {
  268. $version5 = array(
  269. );
  270. $constants = array_merge(
  271. $constants,
  272. $version5
  273. );
  274. }
  275. return $constants;
  276. }
  277. }