| 1 |
<?php |
| 2 |
|
| 3 |
if( ! class_exists( 'wp_mapit_functions' ) ) { |
| 4 |
/** |
| 5 |
* CLass to manage common functions of the plugin |
| 6 |
*/ |
| 7 |
class wp_mapit_functions |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Function to generate a random string |
| 11 |
* |
| 12 |
* @since 1.0 |
| 13 |
* @static |
| 14 |
* @access public |
| 15 |
* @param $length Int Length of the string |
| 16 |
* @return string Returns a random string |
| 17 |
*/ |
| 18 |
public static function generate_random_string($length = 10) { |
| 19 |
return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length); |
| 20 |
} |
| 21 |
} |
| 22 |
} |