@@ -41,46 +41,46 @@ |
||
| 41 | 41 | } //End constructor |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Hash a plain text password. |
|
| 45 | - * |
|
| 46 | - * @param string $password The plain text password to hash. |
|
| 47 | - * @return string The hashed $password parameter. |
|
| 48 | - */ |
|
| 44 | + * Hash a plain text password. |
|
| 45 | + * |
|
| 46 | + * @param string $password The plain text password to hash. |
|
| 47 | + * @return string The hashed $password parameter. |
|
| 48 | + */ |
|
| 49 | 49 | public function password($password) |
| 50 | 50 | { |
| 51 | 51 | return password_hash($password, $this->algo, ['cost' => $this->cost]); |
| 52 | 52 | } //End password |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Check a password against it's hash. |
|
| 56 | - * |
|
| 57 | - * @param string $password Plain text password. |
|
| 58 | - * @param string $hash Hashed password. |
|
| 59 | - * @return bool True if they match, false otherwise. |
|
| 60 | - */ |
|
| 55 | + * Check a password against it's hash. |
|
| 56 | + * |
|
| 57 | + * @param string $password Plain text password. |
|
| 58 | + * @param string $hash Hashed password. |
|
| 59 | + * @return bool True if they match, false otherwise. |
|
| 60 | + */ |
|
| 61 | 61 | public function passwordCheck($password, $hash) |
| 62 | 62 | { |
| 63 | 63 | return password_verify($password, $hash); |
| 64 | 64 | } //End password |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Use sha256 to hash an input string. |
|
| 68 | - * |
|
| 69 | - * @param string $input Plain text string to be hashed. |
|
| 70 | - * @return string The hashed version of the $input string. |
|
| 71 | - */ |
|
| 67 | + * Use sha256 to hash an input string. |
|
| 68 | + * |
|
| 69 | + * @param string $input Plain text string to be hashed. |
|
| 70 | + * @return string The hashed version of the $input string. |
|
| 71 | + */ |
|
| 72 | 72 | public function hash($input) |
| 73 | 73 | { |
| 74 | 74 | return hash('sha256', $input); |
| 75 | 75 | } //End hash |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Check a hash against another. |
|
| 79 | - * |
|
| 80 | - * @param string $know The hash we know is correct. |
|
| 81 | - * @param string $unknown The hash we want to compare with it. |
|
| 82 | - * @return bool True if the hashed strings match, false otherwise. |
|
| 83 | - */ |
|
| 78 | + * Check a hash against another. |
|
| 79 | + * |
|
| 80 | + * @param string $know The hash we know is correct. |
|
| 81 | + * @param string $unknown The hash we want to compare with it. |
|
| 82 | + * @return bool True if the hashed strings match, false otherwise. |
|
| 83 | + */ |
|
| 84 | 84 | public function hashCheck($know, $unknown) |
| 85 | 85 | { |
| 86 | 86 | return hash_equals($know, $unknown); |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function password($password) |
| 50 | 50 | { |
| 51 | - return password_hash($password, $this->algo, ['cost' => $this->cost]); |
|
| 51 | + return password_hash($password, $this->algo, [ 'cost' => $this->cost ]); |
|
| 52 | 52 | } //End password |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -39,14 +39,14 @@ |
||
| 39 | 39 | * @param array $options Optional, additional key/value attributes to include |
| 40 | 40 | * @return string Link to the user's gravatar image. |
| 41 | 41 | */ |
| 42 | - public static function getAvatarUrl($email, $options = []) |
|
| 42 | + public static function getAvatarUrl($email, $options = [ ]) |
|
| 43 | 43 | { |
| 44 | - $size = isset($options['s']) ? $options['s'] : 80; |
|
| 45 | - $imageset = isset($options['d']) ? $options['d'] : 'mm'; |
|
| 46 | - $rating = isset($options['r']) ? $options['r'] : 'g'; |
|
| 47 | - $secure = isset($options['secure']) ? self::HTTPS_URL : self::HTTP_URL; |
|
| 44 | + $size = isset($options[ 's' ]) ? $options[ 's' ] : 80; |
|
| 45 | + $imageset = isset($options[ 'd' ]) ? $options[ 'd' ] : 'mm'; |
|
| 46 | + $rating = isset($options[ 'r' ]) ? $options[ 'r' ] : 'g'; |
|
| 47 | + $secure = isset($options[ 'secure' ]) ? self::HTTPS_URL : self::HTTP_URL; |
|
| 48 | 48 | |
| 49 | - return $secure . md5(strtolower(trim($email))) . '?s=' . $size .'&d=' . $imageset . '&r=' . $rating; |
|
| 49 | + return $secure . md5(strtolower(trim($email))) . '?s=' . $size . '&d=' . $imageset . '&r=' . $rating; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -42,13 +42,13 @@ |
||
| 42 | 42 | public static function SuggestKeyword($param) |
| 43 | 43 | { |
| 44 | 44 | $curlSession = curl_init(); |
| 45 | - curl_setopt($curlSession, CURLOPT_URL, 'https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.$param); |
|
| 45 | + curl_setopt($curlSession, CURLOPT_URL, 'https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q=' . $param); |
|
| 46 | 46 | curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true); |
| 47 | - curl_setopt($curlSession, CURLOPT_HTTPHEADER, ['Content-type: application/json']); |
|
| 47 | + curl_setopt($curlSession, CURLOPT_HTTPHEADER, [ 'Content-type: application/json' ]); |
|
| 48 | 48 | $jsonData = json_decode(curl_exec($curlSession), true); |
| 49 | 49 | curl_close($curlSession); |
| 50 | 50 | |
| 51 | - return $jsonData[1]; |
|
| 51 | + return $jsonData[ 1 ]; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | } |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | curl_setopt($curlSession, CURLOPT_URL, 'http://uploads.im/api?upload'); |
| 45 | 45 | curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true); |
| 46 | 46 | curl_setopt($curlSession, CURLOPT_POST, true); |
| 47 | - curl_setopt($curlSession, CURLOPT_HTTPHEADER, ['Content-Type:multipart/form-data']); |
|
| 48 | - curl_setopt($curlSession, CURLOPT_POSTFIELDS, ['file' => curl_file_create($param, $fileType, $param)]); |
|
| 47 | + curl_setopt($curlSession, CURLOPT_HTTPHEADER, [ 'Content-Type:multipart/form-data' ]); |
|
| 48 | + curl_setopt($curlSession, CURLOPT_POSTFIELDS, [ 'file' => curl_file_create($param, $fileType, $param) ]); |
|
| 49 | 49 | $jsonData = json_decode(curl_exec($curlSession), true); |
| 50 | 50 | curl_close($curlSession); |
| 51 | 51 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | public static function shortUrl($param, $apiKey) |
| 43 | 43 | { |
| 44 | 44 | $curlSession = curl_init(); |
| 45 | - curl_setopt($curlSession, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url?key='.$apiKey); |
|
| 45 | + curl_setopt($curlSession, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url?key=' . $apiKey); |
|
| 46 | 46 | curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true); |
| 47 | 47 | |
| 48 | 48 | $requestData = [ |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | 52 | curl_setopt($curlSession, CURLOPT_POST, true); |
| 53 | - curl_setopt($curlSession, CURLOPT_HTTPHEADER, ['Content-type: application/json']); |
|
| 53 | + curl_setopt($curlSession, CURLOPT_HTTPHEADER, [ 'Content-type: application/json' ]); |
|
| 54 | 54 | curl_setopt($curlSession, CURLOPT_POSTFIELDS, json_encode($requestData)); |
| 55 | 55 | $jsonData = json_decode(curl_exec($curlSession), true); |
| 56 | 56 | curl_close($curlSession); |
| 57 | 57 | |
| 58 | - return $jsonData['id']; |
|
| 58 | + return $jsonData[ 'id' ]; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | } |