@@ -6,33 +6,33 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | spl_autoload_register(function ($class) { |
| 9 | - if (substr($class, 0, 10) !== 'ReCaptcha\\') { |
|
| 10 | - /* If the class does not lie under the "ReCaptcha" namespace, |
|
| 9 | + if (substr($class, 0, 10) !== 'ReCaptcha\\') { |
|
| 10 | + /* If the class does not lie under the "ReCaptcha" namespace, |
|
| 11 | 11 | * then we can exit immediately. |
| 12 | 12 | */ |
| 13 | - return; |
|
| 14 | - } |
|
| 13 | + return; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /* All of the classes have names like "ReCaptcha\Foo", so we need |
|
| 16 | + /* All of the classes have names like "ReCaptcha\Foo", so we need |
|
| 17 | 17 | * to replace the backslashes with frontslashes if we want the |
| 18 | 18 | * name to map directly to a location in the filesystem. |
| 19 | 19 | */ |
| 20 | - $class = str_replace('\\', '/', $class); |
|
| 20 | + $class = str_replace('\\', '/', $class); |
|
| 21 | 21 | |
| 22 | - /* First, check under the current directory. It is important that |
|
| 22 | + /* First, check under the current directory. It is important that |
|
| 23 | 23 | * we look here first, so that we don't waste time searching for |
| 24 | 24 | * test classes in the common case. |
| 25 | 25 | */ |
| 26 | - $path = dirname(__FILE__).'/'.$class.'.php'; |
|
| 27 | - if (is_readable($path)) { |
|
| 28 | - require_once $path; |
|
| 29 | - } |
|
| 26 | + $path = dirname(__FILE__).'/'.$class.'.php'; |
|
| 27 | + if (is_readable($path)) { |
|
| 28 | + require_once $path; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /* If we didn't find what we're looking for already, maybe it's |
|
| 31 | + /* If we didn't find what we're looking for already, maybe it's |
|
| 32 | 32 | * a test class? |
| 33 | 33 | */ |
| 34 | - $path = dirname(__FILE__).'/../tests/'.$class.'.php'; |
|
| 35 | - if (is_readable($path)) { |
|
| 36 | - require_once $path; |
|
| 37 | - } |
|
| 34 | + $path = dirname(__FILE__).'/../tests/'.$class.'.php'; |
|
| 35 | + if (is_readable($path)) { |
|
| 36 | + require_once $path; |
|
| 37 | + } |
|
| 38 | 38 | }); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | * classes. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -spl_autoload_register(function ($class) { |
|
| 8 | +spl_autoload_register(function($class) { |
|
| 9 | 9 | if (substr($class, 0, 10) !== 'ReCaptcha\\') { |
| 10 | 10 | /* If the class does not lie under the "ReCaptcha" namespace, |
| 11 | 11 | * then we can exit immediately. |
@@ -33,87 +33,87 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class SocketPost implements RequestMethod |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * reCAPTCHA service host. |
|
| 38 | - * |
|
| 39 | - * @const string |
|
| 40 | - */ |
|
| 41 | - const RECAPTCHA_HOST = 'www.google.com'; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @const string reCAPTCHA service path |
|
| 45 | - */ |
|
| 46 | - const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @const string Bad request error |
|
| 50 | - */ |
|
| 51 | - const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @const string Bad response error |
|
| 55 | - */ |
|
| 56 | - const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Socket to the reCAPTCHA service |
|
| 60 | - * |
|
| 61 | - * @var Socket |
|
| 62 | - */ |
|
| 63 | - private $socket; |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Constructor |
|
| 67 | - * |
|
| 68 | - * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
|
| 69 | - */ |
|
| 70 | - public function __construct(Socket $socket = null) |
|
| 71 | - { |
|
| 72 | - if (! is_null($socket)) { |
|
| 73 | - $this->socket = $socket; |
|
| 74 | - } else { |
|
| 75 | - $this->socket = new Socket(); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Submit the POST request with the specified parameters. |
|
| 81 | - * |
|
| 82 | - * @param RequestParameters $params Request parameters |
|
| 83 | - * @return string Body of the reCAPTCHA response |
|
| 84 | - */ |
|
| 85 | - public function submit(RequestParameters $params) |
|
| 86 | - { |
|
| 87 | - $errno = 0; |
|
| 88 | - $errstr = ''; |
|
| 89 | - |
|
| 90 | - if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 91 | - $content = $params->toQueryString(); |
|
| 92 | - |
|
| 93 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
| 94 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
| 95 | - $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
| 96 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
| 97 | - $request .= "Connection: close\r\n\r\n"; |
|
| 98 | - $request .= $content . "\r\n\r\n"; |
|
| 99 | - |
|
| 100 | - $this->socket->fwrite($request); |
|
| 101 | - $response = ''; |
|
| 102 | - |
|
| 103 | - while (! $this->socket->feof()) { |
|
| 104 | - $response .= $this->socket->fgets(4096); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $this->socket->fclose(); |
|
| 108 | - |
|
| 109 | - if (0 === strpos($response, 'HTTP/1.1 200 OK')) { |
|
| 110 | - $parts = preg_split("#\n\s*\n#Uis", $response); |
|
| 111 | - return $parts[1]; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - return self::BAD_RESPONSE; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - return self::BAD_REQUEST; |
|
| 118 | - } |
|
| 36 | + /** |
|
| 37 | + * reCAPTCHA service host. |
|
| 38 | + * |
|
| 39 | + * @const string |
|
| 40 | + */ |
|
| 41 | + const RECAPTCHA_HOST = 'www.google.com'; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @const string reCAPTCHA service path |
|
| 45 | + */ |
|
| 46 | + const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @const string Bad request error |
|
| 50 | + */ |
|
| 51 | + const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @const string Bad response error |
|
| 55 | + */ |
|
| 56 | + const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Socket to the reCAPTCHA service |
|
| 60 | + * |
|
| 61 | + * @var Socket |
|
| 62 | + */ |
|
| 63 | + private $socket; |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Constructor |
|
| 67 | + * |
|
| 68 | + * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing |
|
| 69 | + */ |
|
| 70 | + public function __construct(Socket $socket = null) |
|
| 71 | + { |
|
| 72 | + if (! is_null($socket)) { |
|
| 73 | + $this->socket = $socket; |
|
| 74 | + } else { |
|
| 75 | + $this->socket = new Socket(); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Submit the POST request with the specified parameters. |
|
| 81 | + * |
|
| 82 | + * @param RequestParameters $params Request parameters |
|
| 83 | + * @return string Body of the reCAPTCHA response |
|
| 84 | + */ |
|
| 85 | + public function submit(RequestParameters $params) |
|
| 86 | + { |
|
| 87 | + $errno = 0; |
|
| 88 | + $errstr = ''; |
|
| 89 | + |
|
| 90 | + if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 91 | + $content = $params->toQueryString(); |
|
| 92 | + |
|
| 93 | + $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
| 94 | + $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
| 95 | + $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
|
| 96 | + $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
| 97 | + $request .= "Connection: close\r\n\r\n"; |
|
| 98 | + $request .= $content . "\r\n\r\n"; |
|
| 99 | + |
|
| 100 | + $this->socket->fwrite($request); |
|
| 101 | + $response = ''; |
|
| 102 | + |
|
| 103 | + while (! $this->socket->feof()) { |
|
| 104 | + $response .= $this->socket->fgets(4096); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $this->socket->fclose(); |
|
| 108 | + |
|
| 109 | + if (0 === strpos($response, 'HTTP/1.1 200 OK')) { |
|
| 110 | + $parts = preg_split("#\n\s*\n#Uis", $response); |
|
| 111 | + return $parts[1]; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + return self::BAD_RESPONSE; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + return self::BAD_REQUEST; |
|
| 118 | + } |
|
| 119 | 119 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __construct(Socket $socket = null) |
| 71 | 71 | { |
| 72 | - if (! is_null($socket)) { |
|
| 72 | + if ( ! is_null($socket)) { |
|
| 73 | 73 | $this->socket = $socket; |
| 74 | 74 | } else { |
| 75 | 75 | $this->socket = new Socket(); |
@@ -87,20 +87,20 @@ discard block |
||
| 87 | 87 | $errno = 0; |
| 88 | 88 | $errstr = ''; |
| 89 | 89 | |
| 90 | - if ($this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 90 | + if ($this->socket->fsockopen('ssl://'.self::RECAPTCHA_HOST, 443, $errno, $errstr, 30) !== false) { |
|
| 91 | 91 | $content = $params->toQueryString(); |
| 92 | 92 | |
| 93 | - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; |
|
| 94 | - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; |
|
| 93 | + $request = "POST ".self::SITE_VERIFY_PATH." HTTP/1.1\r\n"; |
|
| 94 | + $request .= "Host: ".self::RECAPTCHA_HOST."\r\n"; |
|
| 95 | 95 | $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
| 96 | - $request .= "Content-length: " . strlen($content) . "\r\n"; |
|
| 96 | + $request .= "Content-length: ".strlen($content)."\r\n"; |
|
| 97 | 97 | $request .= "Connection: close\r\n\r\n"; |
| 98 | - $request .= $content . "\r\n\r\n"; |
|
| 98 | + $request .= $content."\r\n\r\n"; |
|
| 99 | 99 | |
| 100 | 100 | $this->socket->fwrite($request); |
| 101 | 101 | $response = ''; |
| 102 | 102 | |
| 103 | - while (! $this->socket->feof()) { |
|
| 103 | + while ( ! $this->socket->feof()) { |
|
| 104 | 104 | $response .= $this->socket->fgets(4096); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -29,79 +29,79 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Socket |
| 31 | 31 | { |
| 32 | - private $handle = null; |
|
| 32 | + private $handle = null; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * fsockopen |
|
| 36 | - * |
|
| 37 | - * @see http://php.net/fsockopen |
|
| 38 | - * @param string $hostname |
|
| 39 | - * @param int $port |
|
| 40 | - * @param int $errno |
|
| 41 | - * @param string $errstr |
|
| 42 | - * @param float $timeout |
|
| 43 | - * @return resource |
|
| 44 | - */ |
|
| 45 | - public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) |
|
| 46 | - { |
|
| 47 | - $this->handle = fsockopen( |
|
| 48 | - $hostname, |
|
| 49 | - $port, |
|
| 50 | - $errno, |
|
| 51 | - $errstr, |
|
| 52 | - (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout) |
|
| 53 | - ); |
|
| 34 | + /** |
|
| 35 | + * fsockopen |
|
| 36 | + * |
|
| 37 | + * @see http://php.net/fsockopen |
|
| 38 | + * @param string $hostname |
|
| 39 | + * @param int $port |
|
| 40 | + * @param int $errno |
|
| 41 | + * @param string $errstr |
|
| 42 | + * @param float $timeout |
|
| 43 | + * @return resource |
|
| 44 | + */ |
|
| 45 | + public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) |
|
| 46 | + { |
|
| 47 | + $this->handle = fsockopen( |
|
| 48 | + $hostname, |
|
| 49 | + $port, |
|
| 50 | + $errno, |
|
| 51 | + $errstr, |
|
| 52 | + (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout) |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - if ($this->handle != false && $errno === 0 && $errstr === '') { |
|
| 56 | - return $this->handle; |
|
| 57 | - } else { |
|
| 58 | - return false; |
|
| 59 | - } |
|
| 60 | - } |
|
| 55 | + if ($this->handle != false && $errno === 0 && $errstr === '') { |
|
| 56 | + return $this->handle; |
|
| 57 | + } else { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * fwrite |
|
| 64 | - * |
|
| 65 | - * @see http://php.net/fwrite |
|
| 66 | - * @param string $string |
|
| 67 | - * @param int $length |
|
| 68 | - * @return int | bool |
|
| 69 | - */ |
|
| 70 | - public function fwrite($string, $length = null) |
|
| 71 | - { |
|
| 72 | - return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length)); |
|
| 73 | - } |
|
| 62 | + /** |
|
| 63 | + * fwrite |
|
| 64 | + * |
|
| 65 | + * @see http://php.net/fwrite |
|
| 66 | + * @param string $string |
|
| 67 | + * @param int $length |
|
| 68 | + * @return int | bool |
|
| 69 | + */ |
|
| 70 | + public function fwrite($string, $length = null) |
|
| 71 | + { |
|
| 72 | + return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length)); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * fgets |
|
| 77 | - * |
|
| 78 | - * @see http://php.net/fgets |
|
| 79 | - * @param int $length |
|
| 80 | - */ |
|
| 81 | - public function fgets($length = null) |
|
| 82 | - { |
|
| 83 | - return fgets($this->handle, $length); |
|
| 84 | - } |
|
| 75 | + /** |
|
| 76 | + * fgets |
|
| 77 | + * |
|
| 78 | + * @see http://php.net/fgets |
|
| 79 | + * @param int $length |
|
| 80 | + */ |
|
| 81 | + public function fgets($length = null) |
|
| 82 | + { |
|
| 83 | + return fgets($this->handle, $length); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * feof |
|
| 88 | - * |
|
| 89 | - * @see http://php.net/feof |
|
| 90 | - * @return bool |
|
| 91 | - */ |
|
| 92 | - public function feof() |
|
| 93 | - { |
|
| 94 | - return feof($this->handle); |
|
| 95 | - } |
|
| 86 | + /** |
|
| 87 | + * feof |
|
| 88 | + * |
|
| 89 | + * @see http://php.net/feof |
|
| 90 | + * @return bool |
|
| 91 | + */ |
|
| 92 | + public function feof() |
|
| 93 | + { |
|
| 94 | + return feof($this->handle); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * fclose |
|
| 99 | - * |
|
| 100 | - * @see http://php.net/fclose |
|
| 101 | - * @return bool |
|
| 102 | - */ |
|
| 103 | - public function fclose() |
|
| 104 | - { |
|
| 105 | - return fclose($this->handle); |
|
| 106 | - } |
|
| 97 | + /** |
|
| 98 | + * fclose |
|
| 99 | + * |
|
| 100 | + * @see http://php.net/fclose |
|
| 101 | + * @return bool |
|
| 102 | + */ |
|
| 103 | + public function fclose() |
|
| 104 | + { |
|
| 105 | + return fclose($this->handle); |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -17,98 +17,98 @@ |
||
| 17 | 17 | class CheckinStatusDashicon |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var int $checkin_status |
|
| 22 | - */ |
|
| 23 | - private $checkin_status; |
|
| 20 | + /** |
|
| 21 | + * @var int $checkin_status |
|
| 22 | + */ |
|
| 23 | + private $checkin_status; |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * CheckinStatusDashicon constructor. |
|
| 28 | - * |
|
| 29 | - * @param int $checkin_status |
|
| 30 | - */ |
|
| 31 | - public function __construct($checkin_status = EE_Checkin::status_checked_never) |
|
| 32 | - { |
|
| 33 | - $this->checkin_status = $checkin_status; |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * CheckinStatusDashicon constructor. |
|
| 28 | + * |
|
| 29 | + * @param int $checkin_status |
|
| 30 | + */ |
|
| 31 | + public function __construct($checkin_status = EE_Checkin::status_checked_never) |
|
| 32 | + { |
|
| 33 | + $this->checkin_status = $checkin_status; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param EE_Checkin $checkin |
|
| 39 | - * @return CheckinStatusDashicon |
|
| 40 | - * @throws EE_Error |
|
| 41 | - */ |
|
| 42 | - public static function fromCheckin(EE_Checkin $checkin) |
|
| 43 | - { |
|
| 44 | - return new CheckinStatusDashicon( |
|
| 45 | - $checkin->status() |
|
| 46 | - ? EE_Checkin::status_checked_in |
|
| 47 | - : EE_Checkin::status_checked_out |
|
| 48 | - ); |
|
| 49 | - } |
|
| 37 | + /** |
|
| 38 | + * @param EE_Checkin $checkin |
|
| 39 | + * @return CheckinStatusDashicon |
|
| 40 | + * @throws EE_Error |
|
| 41 | + */ |
|
| 42 | + public static function fromCheckin(EE_Checkin $checkin) |
|
| 43 | + { |
|
| 44 | + return new CheckinStatusDashicon( |
|
| 45 | + $checkin->status() |
|
| 46 | + ? EE_Checkin::status_checked_in |
|
| 47 | + : EE_Checkin::status_checked_out |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param EE_Registration $registration |
|
| 54 | - * @param EE_Datetime $datetime |
|
| 55 | - * @return CheckinStatusDashicon |
|
| 56 | - * @throws EE_Error |
|
| 57 | - */ |
|
| 58 | - public static function fromRegistrationAndDatetime(EE_Registration $registration, EE_Datetime $datetime) |
|
| 59 | - { |
|
| 60 | - return new CheckinStatusDashicon( |
|
| 61 | - $registration->check_in_status_for_datetime( |
|
| 62 | - $datetime->ID() |
|
| 63 | - ) |
|
| 64 | - ); |
|
| 65 | - } |
|
| 52 | + /** |
|
| 53 | + * @param EE_Registration $registration |
|
| 54 | + * @param EE_Datetime $datetime |
|
| 55 | + * @return CheckinStatusDashicon |
|
| 56 | + * @throws EE_Error |
|
| 57 | + */ |
|
| 58 | + public static function fromRegistrationAndDatetime(EE_Registration $registration, EE_Datetime $datetime) |
|
| 59 | + { |
|
| 60 | + return new CheckinStatusDashicon( |
|
| 61 | + $registration->check_in_status_for_datetime( |
|
| 62 | + $datetime->ID() |
|
| 63 | + ) |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @param EE_Registration $registration |
|
| 70 | - * @param int $DTT_ID |
|
| 71 | - * @return CheckinStatusDashicon |
|
| 72 | - * @throws EE_Error |
|
| 73 | - */ |
|
| 74 | - public static function fromRegistrationAndDatetimeId(EE_Registration $registration, $DTT_ID = 0) |
|
| 75 | - { |
|
| 76 | - return new CheckinStatusDashicon( |
|
| 77 | - $registration->check_in_status_for_datetime( |
|
| 78 | - absint($DTT_ID) |
|
| 79 | - ) |
|
| 80 | - ); |
|
| 81 | - } |
|
| 68 | + /** |
|
| 69 | + * @param EE_Registration $registration |
|
| 70 | + * @param int $DTT_ID |
|
| 71 | + * @return CheckinStatusDashicon |
|
| 72 | + * @throws EE_Error |
|
| 73 | + */ |
|
| 74 | + public static function fromRegistrationAndDatetimeId(EE_Registration $registration, $DTT_ID = 0) |
|
| 75 | + { |
|
| 76 | + return new CheckinStatusDashicon( |
|
| 77 | + $registration->check_in_status_for_datetime( |
|
| 78 | + absint($DTT_ID) |
|
| 79 | + ) |
|
| 80 | + ); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Will return the correct set of dashicon css classes for the set checkin status |
|
| 85 | - * |
|
| 86 | - * @return string |
|
| 87 | - */ |
|
| 88 | - public function cssClasses() |
|
| 89 | - { |
|
| 90 | - if ($this->checkin_status === EE_Checkin::status_checked_in) { |
|
| 91 | - return "ee-dashicons ee-icon-check-in checkin-icons checkedin-status-{$this->checkin_status}"; |
|
| 92 | - } |
|
| 93 | - if ($this->checkin_status === EE_Checkin::status_checked_out) { |
|
| 94 | - return "ee-dashicons ee-icon-check-out checkin-icons checkedin-status-{$this->checkin_status}"; |
|
| 95 | - } |
|
| 96 | - return "dashicons dashicons-no checkin-icons checkedin-status-{$this->checkin_status}"; |
|
| 97 | - } |
|
| 83 | + /** |
|
| 84 | + * Will return the correct set of dashicon css classes for the set checkin status |
|
| 85 | + * |
|
| 86 | + * @return string |
|
| 87 | + */ |
|
| 88 | + public function cssClasses() |
|
| 89 | + { |
|
| 90 | + if ($this->checkin_status === EE_Checkin::status_checked_in) { |
|
| 91 | + return "ee-dashicons ee-icon-check-in checkin-icons checkedin-status-{$this->checkin_status}"; |
|
| 92 | + } |
|
| 93 | + if ($this->checkin_status === EE_Checkin::status_checked_out) { |
|
| 94 | + return "ee-dashicons ee-icon-check-out checkin-icons checkedin-status-{$this->checkin_status}"; |
|
| 95 | + } |
|
| 96 | + return "dashicons dashicons-no checkin-icons checkedin-status-{$this->checkin_status}"; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * returns a description for the Checkin Status Dashicon that can be used in List Table Legends |
|
| 101 | - * |
|
| 102 | - * @return string |
|
| 103 | - */ |
|
| 104 | - public function legendLabel() |
|
| 105 | - { |
|
| 106 | - if ($this->checkin_status === EE_Checkin::status_checked_in) { |
|
| 107 | - return esc_html__('This Registrant has been Checked In', 'event_espresso'); |
|
| 108 | - } |
|
| 109 | - if ($this->checkin_status === EE_Checkin::status_checked_out) { |
|
| 110 | - return esc_html__('This Registrant has been Checked Out', 'event_espresso'); |
|
| 111 | - } |
|
| 112 | - return esc_html__('No Check-in Record has been Created for this Registrant', 'event_espresso'); |
|
| 113 | - } |
|
| 99 | + /** |
|
| 100 | + * returns a description for the Checkin Status Dashicon that can be used in List Table Legends |
|
| 101 | + * |
|
| 102 | + * @return string |
|
| 103 | + */ |
|
| 104 | + public function legendLabel() |
|
| 105 | + { |
|
| 106 | + if ($this->checkin_status === EE_Checkin::status_checked_in) { |
|
| 107 | + return esc_html__('This Registrant has been Checked In', 'event_espresso'); |
|
| 108 | + } |
|
| 109 | + if ($this->checkin_status === EE_Checkin::status_checked_out) { |
|
| 110 | + return esc_html__('This Registrant has been Checked Out', 'event_espresso'); |
|
| 111 | + } |
|
| 112 | + return esc_html__('No Check-in Record has been Created for this Registrant', 'event_espresso'); |
|
| 113 | + } |
|
| 114 | 114 | } |
@@ -15,27 +15,27 @@ |
||
| 15 | 15 | { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * EntityNotFoundException constructor |
|
| 20 | - * |
|
| 21 | - * @param string $identifier_type the name of the identifier used (ie: ID, Name, etc) |
|
| 22 | - * @param string $identifier the actual data value used to retrieve the entity |
|
| 23 | - * @param string $message |
|
| 24 | - * @param int $code |
|
| 25 | - * @param \Exception $previous |
|
| 26 | - */ |
|
| 27 | - public function __construct($identifier_type, $identifier, $message = '', $code = 0, \Exception $previous = null) |
|
| 28 | - { |
|
| 29 | - if (empty($message)) { |
|
| 30 | - $message = sprintf( |
|
| 31 | - __( |
|
| 32 | - 'The requested entity with %1$s="%2$s" was not found.', |
|
| 33 | - 'event_espresso' |
|
| 34 | - ), |
|
| 35 | - $identifier_type, |
|
| 36 | - $identifier |
|
| 37 | - ); |
|
| 38 | - } |
|
| 39 | - parent::__construct($message, $code, $previous); |
|
| 40 | - } |
|
| 18 | + /** |
|
| 19 | + * EntityNotFoundException constructor |
|
| 20 | + * |
|
| 21 | + * @param string $identifier_type the name of the identifier used (ie: ID, Name, etc) |
|
| 22 | + * @param string $identifier the actual data value used to retrieve the entity |
|
| 23 | + * @param string $message |
|
| 24 | + * @param int $code |
|
| 25 | + * @param \Exception $previous |
|
| 26 | + */ |
|
| 27 | + public function __construct($identifier_type, $identifier, $message = '', $code = 0, \Exception $previous = null) |
|
| 28 | + { |
|
| 29 | + if (empty($message)) { |
|
| 30 | + $message = sprintf( |
|
| 31 | + __( |
|
| 32 | + 'The requested entity with %1$s="%2$s" was not found.', |
|
| 33 | + 'event_espresso' |
|
| 34 | + ), |
|
| 35 | + $identifier_type, |
|
| 36 | + $identifier |
|
| 37 | + ); |
|
| 38 | + } |
|
| 39 | + parent::__construct($message, $code, $previous); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -13,25 +13,25 @@ |
||
| 13 | 13 | { |
| 14 | 14 | |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * InvalidFormSubmissionException constructor |
|
| 18 | - * |
|
| 19 | - * @param string $form_name |
|
| 20 | - * @param string $message |
|
| 21 | - * @param int $code |
|
| 22 | - * @param \Exception $previous |
|
| 23 | - */ |
|
| 24 | - public function __construct($form_name, $message = '', $code = 0, \Exception $previous = null) |
|
| 25 | - { |
|
| 26 | - if (empty($message)) { |
|
| 27 | - $message = sprintf( |
|
| 28 | - __( |
|
| 29 | - 'The data for the "%1$s" form, is either missing or was not submitted properly.', |
|
| 30 | - 'event_espresso' |
|
| 31 | - ), |
|
| 32 | - $form_name |
|
| 33 | - ); |
|
| 34 | - } |
|
| 35 | - parent::__construct($message, $code, $previous); |
|
| 36 | - } |
|
| 16 | + /** |
|
| 17 | + * InvalidFormSubmissionException constructor |
|
| 18 | + * |
|
| 19 | + * @param string $form_name |
|
| 20 | + * @param string $message |
|
| 21 | + * @param int $code |
|
| 22 | + * @param \Exception $previous |
|
| 23 | + */ |
|
| 24 | + public function __construct($form_name, $message = '', $code = 0, \Exception $previous = null) |
|
| 25 | + { |
|
| 26 | + if (empty($message)) { |
|
| 27 | + $message = sprintf( |
|
| 28 | + __( |
|
| 29 | + 'The data for the "%1$s" form, is either missing or was not submitted properly.', |
|
| 30 | + 'event_espresso' |
|
| 31 | + ), |
|
| 32 | + $form_name |
|
| 33 | + ); |
|
| 34 | + } |
|
| 35 | + parent::__construct($message, $code, $previous); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -15,22 +15,22 @@ |
||
| 15 | 15 | class InvalidClassException extends DomainException |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * InvalidClassException constructor. |
|
| 20 | - * |
|
| 21 | - * @param string $class_name |
|
| 22 | - * @param string $message |
|
| 23 | - * @param int $code |
|
| 24 | - * @param \Exception $previous |
|
| 25 | - */ |
|
| 26 | - public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null) |
|
| 27 | - { |
|
| 28 | - if (empty($message)) { |
|
| 29 | - $message = sprintf( |
|
| 30 | - __('The "%1$s" Class is either missing or invalid.', 'event_espresso'), |
|
| 31 | - $class_name |
|
| 32 | - ); |
|
| 33 | - } |
|
| 34 | - parent::__construct($message, $code, $previous); |
|
| 35 | - } |
|
| 18 | + /** |
|
| 19 | + * InvalidClassException constructor. |
|
| 20 | + * |
|
| 21 | + * @param string $class_name |
|
| 22 | + * @param string $message |
|
| 23 | + * @param int $code |
|
| 24 | + * @param \Exception $previous |
|
| 25 | + */ |
|
| 26 | + public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null) |
|
| 27 | + { |
|
| 28 | + if (empty($message)) { |
|
| 29 | + $message = sprintf( |
|
| 30 | + __('The "%1$s" Class is either missing or invalid.', 'event_espresso'), |
|
| 31 | + $class_name |
|
| 32 | + ); |
|
| 33 | + } |
|
| 34 | + parent::__construct($message, $code, $previous); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -15,66 +15,66 @@ |
||
| 15 | 15 | class IpnException extends \LogicException |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - const DUPLICATE = 1; |
|
| 18 | + const DUPLICATE = 1; |
|
| 19 | 19 | |
| 20 | - const UNABLE_TO_VALIDATE = 2; |
|
| 20 | + const UNABLE_TO_VALIDATE = 2; |
|
| 21 | 21 | |
| 22 | - const UNSUPPORTED = 3; |
|
| 22 | + const UNSUPPORTED = 3; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var \EE_Payment |
|
| 26 | - */ |
|
| 27 | - protected $payment; |
|
| 24 | + /** |
|
| 25 | + * @var \EE_Payment |
|
| 26 | + */ |
|
| 27 | + protected $payment; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var mixed IPN data, usually an array or object |
|
| 31 | - */ |
|
| 32 | - protected $ipn_data; |
|
| 29 | + /** |
|
| 30 | + * @var mixed IPN data, usually an array or object |
|
| 31 | + */ |
|
| 32 | + protected $ipn_data; |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - public function __construct( |
|
| 36 | - $message, |
|
| 37 | - $code = 0, |
|
| 38 | - \Exception $previous = null, |
|
| 39 | - \EE_Payment $payment = null, |
|
| 40 | - $ipn_data = array() |
|
| 41 | - ) { |
|
| 42 | - parent::__construct($message, $code, $previous); |
|
| 43 | - $this->payment = $payment; |
|
| 44 | - $this->ipn_data = $ipn_data; |
|
| 45 | - } |
|
| 35 | + public function __construct( |
|
| 36 | + $message, |
|
| 37 | + $code = 0, |
|
| 38 | + \Exception $previous = null, |
|
| 39 | + \EE_Payment $payment = null, |
|
| 40 | + $ipn_data = array() |
|
| 41 | + ) { |
|
| 42 | + parent::__construct($message, $code, $previous); |
|
| 43 | + $this->payment = $payment; |
|
| 44 | + $this->ipn_data = $ipn_data; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Gets the payment associated with this IPN, if known |
|
| 50 | - * |
|
| 51 | - * @return \EE_Payment |
|
| 52 | - */ |
|
| 53 | - public function getPayment() |
|
| 54 | - { |
|
| 55 | - return $this->payment; |
|
| 56 | - } |
|
| 48 | + /** |
|
| 49 | + * Gets the payment associated with this IPN, if known |
|
| 50 | + * |
|
| 51 | + * @return \EE_Payment |
|
| 52 | + */ |
|
| 53 | + public function getPayment() |
|
| 54 | + { |
|
| 55 | + return $this->payment; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array) |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - * @throws \EE_Error |
|
| 64 | - */ |
|
| 65 | - public function getPaymentProperties() |
|
| 66 | - { |
|
| 67 | - return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array(); |
|
| 68 | - } |
|
| 59 | + /** |
|
| 60 | + * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array) |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + * @throws \EE_Error |
|
| 64 | + */ |
|
| 65 | + public function getPaymentProperties() |
|
| 66 | + { |
|
| 67 | + return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Returns an array, object, or string, however, the IPN data was received |
|
| 73 | - * |
|
| 74 | - * @return mixed |
|
| 75 | - */ |
|
| 76 | - public function getIpnData() |
|
| 77 | - { |
|
| 78 | - return $this->ipn_data; |
|
| 79 | - } |
|
| 71 | + /** |
|
| 72 | + * Returns an array, object, or string, however, the IPN data was received |
|
| 73 | + * |
|
| 74 | + * @return mixed |
|
| 75 | + */ |
|
| 76 | + public function getIpnData() |
|
| 77 | + { |
|
| 78 | + return $this->ipn_data; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -12,18 +12,18 @@ |
||
| 12 | 12 | class InvalidSessionDataException extends \Exception |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * InvalidInterfaceException constructor. |
|
| 17 | - * |
|
| 18 | - * @param string $message |
|
| 19 | - * @param int $code |
|
| 20 | - * @param \Exception $previous |
|
| 21 | - */ |
|
| 22 | - public function __construct($message = '', $code = 0, \Exception $previous = null) |
|
| 23 | - { |
|
| 24 | - if (empty($message)) { |
|
| 25 | - $message = esc_html__('The session data is either missing or invalid.', 'event_espresso'); |
|
| 26 | - } |
|
| 27 | - parent::__construct($message, $code, $previous); |
|
| 28 | - } |
|
| 15 | + /** |
|
| 16 | + * InvalidInterfaceException constructor. |
|
| 17 | + * |
|
| 18 | + * @param string $message |
|
| 19 | + * @param int $code |
|
| 20 | + * @param \Exception $previous |
|
| 21 | + */ |
|
| 22 | + public function __construct($message = '', $code = 0, \Exception $previous = null) |
|
| 23 | + { |
|
| 24 | + if (empty($message)) { |
|
| 25 | + $message = esc_html__('The session data is either missing or invalid.', 'event_espresso'); |
|
| 26 | + } |
|
| 27 | + parent::__construct($message, $code, $previous); |
|
| 28 | + } |
|
| 29 | 29 | } |