PageRenderTime 26ms CodeModel.GetById 9ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/php-bartlett-PHP-CompatInfo-2.5.0/PHP_CompatInfo-2.5.0/PHP/CompatInfo/Reference/mcrypt.php

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