Changeset 2480507
- Timestamp:
- 02/24/2021 10:09:30 AM (5 years ago)
- Location:
- miqid-core/trunk
- Files:
-
- 24 added
- 11 deleted
- 33 edited
-
miqid-core.php (modified) (1 diff)
-
readme.md (modified) (1 diff)
-
src/Admin/Init.php (modified) (4 diffs)
-
src/Admin/User_Switching.php (modified) (3 diffs)
-
src/Classes/API/Address.php (modified) (1 diff)
-
src/Classes/API/Base.php (modified) (5 diffs)
-
src/Classes/API/Business (added)
-
src/Classes/API/Business/Base.php (added)
-
src/Classes/API/Business/Certificate.php (added)
-
src/Classes/API/Business/Kyc.php (added)
-
src/Classes/API/Business/MyBody.php (added)
-
src/Classes/API/Business/Profile.php (added)
-
src/Classes/API/Business/UserAddress.php (added)
-
src/Classes/API/CompanyCertificate.php (deleted)
-
src/Classes/API/CompanyProfile.php (deleted)
-
src/Classes/API/Kyc.php (deleted)
-
src/Classes/API/MyBody.php (added)
-
src/Classes/DTO/Address.php (modified) (1 diff)
-
src/Classes/DTO/Base.php (modified) (2 diffs)
-
src/Classes/DTO/Business (added)
-
src/Classes/DTO/Business/Certificate.php (added)
-
src/Classes/DTO/Business/DriversLicense.php (added)
-
src/Classes/DTO/Business/Kyc.php (added)
-
src/Classes/DTO/Business/MyBody.php (added)
-
src/Classes/DTO/Business/Passport.php (added)
-
src/Classes/DTO/Business/Profile.php (added)
-
src/Classes/DTO/Business/UserAddress.php (added)
-
src/Classes/DTO/Company.php (modified) (1 diff)
-
src/Classes/DTO/CompanyAddress.php (deleted)
-
src/Classes/DTO/CompanyCountry.php (modified) (1 diff)
-
src/Classes/DTO/CompanyCountryDepartment.php (modified) (1 diff)
-
src/Classes/DTO/CompanyProfile.php (deleted)
-
src/Classes/DTO/CompanyRole.php (modified) (1 diff)
-
src/Classes/DTO/CompanyType.php (modified) (1 diff)
-
src/Classes/DTO/DriversLicense.php (deleted)
-
src/Classes/DTO/FileContentResult.php (modified) (1 diff)
-
src/Classes/DTO/HealthInsuranceCard.php (modified) (1 diff)
-
src/Classes/DTO/HttpResponse.php (modified) (2 diffs)
-
src/Classes/DTO/IFormFile.php (modified) (2 diffs)
-
src/Classes/DTO/JWT.php (modified) (2 diffs)
-
src/Classes/DTO/Kyc.php (deleted)
-
src/Classes/DTO/Login.php (modified) (1 diff)
-
src/Classes/DTO/MyBody.php (modified) (1 diff)
-
src/Classes/DTO/Passport.php (deleted)
-
src/Classes/DTO/Profile.php (modified) (9 diffs)
-
src/Classes/DTO/ProfilePicture.php (modified) (1 diff)
-
src/Classes/DTO/SignUp.php (modified) (3 diffs)
-
src/Classes/Feature.php (modified) (2 diffs)
-
src/Classes/Utilities (deleted)
-
src/Frontend/Ajax/Ajax.php (modified) (1 diff)
-
src/Frontend/Ajax/CompanyProfile.php (modified) (3 diffs)
-
src/Frontend/Filter (deleted)
-
src/Frontend/Filter.php (deleted)
-
src/Frontend/Frontend.php (modified) (2 diffs)
-
src/Frontend/Shortcode/Address.php (added)
-
src/Frontend/Shortcode/Business (added)
-
src/Frontend/Shortcode/Business/Kyc.php (added)
-
src/Frontend/Shortcode/Business/MyBody.php (added)
-
src/Frontend/Shortcode/Business/Profile.php (added)
-
src/Frontend/Shortcode/Business/UserAddress.php (added)
-
src/Frontend/Shortcode/Login.php (modified) (3 diffs)
-
src/Frontend/Shortcode/MIQID.php (modified) (2 diffs)
-
src/Frontend/Shortcode/MyBody.php (added)
-
src/Frontend/Shortcode/Profile.php (added)
-
src/Frontend/Shortcode/Shortcode.php (modified) (2 diffs)
-
src/Frontend/User_Switching.php (modified) (19 diffs)
-
src/Frontend/WP_Login.php (modified) (3 diffs)
-
src/Util.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
miqid-core/trunk/miqid-core.php
r2476124 r2480507 3 3 * Plugin Name: MIQID-Core 4 4 * Description: MIQID-Core handle the basics. 5 * Version: 1. 5.75 * Version: 1.6.0 6 6 * Requires at least: 5.2 7 7 * Requires PHP: 7.2 -
miqid-core/trunk/readme.md
r2476124 r2480507 4 4 Tested up to: 5.6 5 5 Requires PHP: 7.2 6 Stable tag: 1. 5.76 Stable tag: 1.6.0 7 7 License: GPL v3 or later 8 8 -
miqid-core/trunk/src/Admin/Init.php
r2467105 r2480507 3 3 namespace MIQID\Plugin\Core\Admin; 4 4 5 6 5 use MIQID\Plugin\Core\{Classes\Feature, Util}; 6 use ReflectionClass; 7 7 8 8 class Init { … … 90 90 switch ( $tab ) { 91 91 case self::SHORTCODE: 92 $ ShortCodes= [];93 $ShortCodes['miqid-login'] = sprintf( '[miqid-login] - %s', __( 'Makes a login form that you can place where on the page you want.', 'miqid-core' ) );94 foreach ( [ 'profile', 'address' ] as $class ) {95 if ( ( $class = sprintf( 'MIQID\Plugin\Core\Classes\DTO\\%s', ucwords( $class ) ) ) && class_exists( $class )) {96 $class = new \ReflectionClass( $class );97 foreach ( $class->getProperties() as $reflection_property ) {98 $shortcode = sprintf( 'miqid %s="%s"', $class->getShortName(), $reflection_property->getName());99 $ShortCodes[ $shortcode ] = sprintf( '[%s] - %s', $shortcode,100 sprintf( __( 'Viser %1$s fra %2$s' ),101 __( $reflection_property->getName(), 'miqid-core' ),102 __( $class->getShortName(), 'miqid-core' ) )103 );104 } 92 $tbody = []; 93 //$ShortCodes = []; 94 $tbody[] = sprintf( '<tr><td>[miqid-login]</td><td>%s</td></tr>', __( 'Makes a login form that you can place where on the page you want.', 'miqid-core' ) ); 95 foreach ( [ 'Profile', 'Address', 'MyBody' ] as $class ) { 96 if ( ( $class = sprintf( 'MIQID\Plugin\Core\Classes\DTO\\%s', $class ) ) && class_exists( $class ) ) { 97 $ReflectionClass = new ReflectionClass( $class ); 98 $short_name = $ReflectionClass->getShortName(); 99 do { 100 foreach ( $ReflectionClass->getProperties() as $property ) { 101 $short_code = sprintf( '[miqid-%1$s fields="%2$s"]', mb_strtolower( $short_name ), $property->getName() ); 102 $tbody[] = sprintf( '<tr><td>%1$s</td><td>%2$s</td></tr>', $short_code, do_shortcode( $short_code ) ); 103 } 104 } while ( $ReflectionClass = $ReflectionClass->getParentClass() ); 105 105 } 106 106 } 107 printf( '<ul><li>%s</li></ul>', implode( '</li><li>', $ShortCodes ) ); 107 printf( '<table> 108 <thead> 109 <tr> 110 <th style="text-align: left">Shortcode</th> 111 <th style="text-align: left">Data / Beskrivelse</th> 112 </tr> 113 </thead> 114 <tbody>%1$s</tbody> 115 </table>', implode( $tbody ) ); 108 116 break; 109 117 default: … … 112 120 do_settings_sections( 'miqid-core' ); 113 121 submit_button(); 114 printf( '</form>' );115 122 break; 116 123 } … … 133 140 ); 134 141 add_settings_field( 142 'jwt', 143 __( 'JWT Token', 'miqid-core' ), 144 function () { 145 printf( '<input type="text" name="miqid-core[JWT]" value="%1$s" />', 146 $this->feature->get_JWT() ); 147 }, 148 'miqid-core', 149 'miqid-core' 150 ); 151 add_settings_field( 135 152 'user_switching_enabled', 136 153 __( 'User Switching Enabled', 'miqid-core' ), -
miqid-core/trunk/src/Admin/User_Switching.php
r2466954 r2480507 7 7 class User_Switching extends \MIQID\Plugin\Core\Frontend\User_Switching { 8 8 9 /** @noinspection PhpMissingParentConstructorInspection */ 9 10 public function __construct() { 10 11 add_action( 'all_admin_notices', [ $this, '_notices' ], 1 ); … … 88 89 ], 89 90 ] ); 91 print '</p>'; 90 92 ?> 91 </p>92 93 </div> 93 94 <?php … … 130 131 * @return string[] Array of actions to display for this user row. 131 132 */ 132 public function filter_user_row_actions( array $actions, WP_User $user ) {133 public function filter_user_row_actions( array $actions, WP_User $user ): array { 133 134 $link = self::maybe_switch_url( $user ); 134 135 -
miqid-core/trunk/src/Classes/API/Address.php
r2466954 r2480507 14 14 15 15 return self::$instance; 16 } 17 18 private function __construct() { 16 19 } 17 20 -
miqid-core/trunk/src/Classes/API/Base.php
r2474729 r2480507 4 4 5 5 use MIQID\Plugin\Core\Classes\DTO\{HttpResponse, JWT}; 6 use ReflectionClass; 7 use ReflectionException; 6 8 7 9 if ( ! defined( 'MIQID_ENDPOINT_DOMAIN' ) ) { … … 12 14 /** 13 15 * @return self; 16 * @noinspection PhpMissingReturnTypeInspection 14 17 */ 15 18 abstract static function Instance(); … … 23 26 */ 24 27 protected function RemoteGet( $url, $JWT = null, array $args = [] ): HttpResponse { 25 if ( !is_null($JWT) &&is_string( $JWT ) ) {26 $JWT = new JWT( $JWT );28 if ( is_string( $JWT ) ) { 29 $JWT = ( new JWT() )->set_jwt( $JWT ); 27 30 } 28 31 … … 51 54 $body = json_encode( $body ); 52 55 } 53 if ( ! is_null($JWT) && is_string( $JWT ) ) {56 if ( ! is_null( $JWT ) && is_string( $JWT ) ) { 54 57 $JWT = new JWT( $JWT ); 55 58 } … … 79 82 * @return string 80 83 */ 81 protected function GetEndpoint( $Function ) {84 protected function GetEndpoint( $Function ): string { 82 85 $class = $this; 83 86 84 87 try { 85 $class = new \ReflectionClass( $this );86 } catch ( \ReflectionException $e ) {88 $class = new ReflectionClass( $this ); 89 } catch ( ReflectionException $e ) { 87 90 88 91 } -
miqid-core/trunk/src/Classes/DTO/Address.php
r2467105 r2480507 226 226 } 227 227 228 public function jsonSerialize() {228 public function jsonSerialize(): array { 229 229 return get_object_vars( $this ); 230 230 } -
miqid-core/trunk/src/Classes/DTO/Base.php
r2466954 r2480507 7 7 8 8 abstract class Base implements JsonSerializable { 9 /** @var HttpResponse|null */10 private $HttpResponse;11 12 9 /** 13 * @param $array The to parse to object, will be cleared after. 10 * @param array $array The to parse to object, will be cleared after. 11 * 12 * @return self 14 13 */ 15 protected function parse_array( &$array ){14 protected function parse_array( array &$array ): self { 16 15 foreach ( $array as $key => $value ) { 17 16 $function = sprintf( 'set_%s', Util::snake_case( $key ) ); … … 26 25 return $this; 27 26 } 28 29 public function set_http_response( HttpResponse $http_response ) {30 $this->HttpResponse = $http_response ?? $this->HttpResponse;31 }32 33 /**34 * @return HttpResponse|null35 */36 public function get_http_response(): ?HttpResponse {37 return $this->HttpResponse;38 }39 27 } -
miqid-core/trunk/src/Classes/DTO/Company.php
r2466954 r2480507 117 117 } 118 118 119 public function jsonSerialize() {119 public function jsonSerialize(): array { 120 120 $arr = get_object_vars( $this ); 121 121 $arr['companyType'] = $this->get_company_type(); -
miqid-core/trunk/src/Classes/DTO/CompanyCountry.php
r2466954 r2480507 74 74 } 75 75 76 public function jsonSerialize() {76 public function jsonSerialize(): array { 77 77 $arr = array_merge( 78 78 get_object_vars( $this ), -
miqid-core/trunk/src/Classes/DTO/CompanyCountryDepartment.php
r2466954 r2480507 9 9 private $companyCountryId; 10 10 11 public function jsonSerialize() { 11 /** 12 * @return array 13 */ 14 public function jsonSerialize(): array { 12 15 $arr = array_merge( 13 16 get_object_vars( $this ), -
miqid-core/trunk/src/Classes/DTO/CompanyRole.php
r2466954 r2480507 64 64 } 65 65 66 public function jsonSerialize() {66 public function jsonSerialize(): array { 67 67 return get_object_vars( $this ); 68 68 } -
miqid-core/trunk/src/Classes/DTO/CompanyType.php
r2466954 r2480507 63 63 } 64 64 65 public function jsonSerialize() {65 public function jsonSerialize(): array { 66 66 $arr = get_object_vars( $this ); 67 67 $arr['roles'] = $this->get_roles(); -
miqid-core/trunk/src/Classes/DTO/FileContentResult.php
r2466954 r2480507 36 36 37 37 /** 38 * @param string|null $contentType38 * @param array|string|null $contentType 39 39 */ 40 40 public function set_content_type( $contentType ): void { -
miqid-core/trunk/src/Classes/DTO/HealthInsuranceCard.php
r2466954 r2480507 243 243 244 244 245 public function jsonSerialize() {245 public function jsonSerialize(): array { 246 246 return get_object_vars( $this ); 247 247 } -
miqid-core/trunk/src/Classes/DTO/HttpResponse.php
r2466954 r2480507 17 17 * 18 18 * @param array|WP_Error $response 19 * @param $url 20 * @param $args 19 21 */ 20 22 public function __construct( $response, $url, $args ) { 21 $this->response_code = wp_remote_retrieve_response_code( $response ); 22 $this->response_message = wp_remote_retrieve_response_message( $response ); 23 $this->headers = wp_remote_retrieve_headers( $response ); 24 $this->body = wp_remote_retrieve_body( $response ); 25 $this->url = $url; 26 $this->args = $args; 23 if ( is_wp_error( $response ) ) { 24 $this->response_message = $response->get_error_message(); 25 } else { 26 $this->response_code = wp_remote_retrieve_response_code( $response ); 27 $this->response_message = wp_remote_retrieve_response_message( $response ); 28 $this->headers = wp_remote_retrieve_headers( $response ); 29 $this->body = wp_remote_retrieve_body( $response ); 30 } 31 $this->url = $url; 32 $this->args = $args; 27 33 } 28 34 29 35 /** @return int */ 30 public function get_response_code() {36 public function get_response_code(): int { 31 37 return filter_var( $this->response_code, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE ) ?? 0; 32 38 } … … 57 63 } 58 64 59 public function jsonSerialize() {65 public function jsonSerialize(): array { 60 66 return get_object_vars( $this ); 61 67 } -
miqid-core/trunk/src/Classes/DTO/IFormFile.php
r2466954 r2480507 96 96 * @return array|null 97 97 */ 98 public function get_headers() {98 public function get_headers(): ?array { 99 99 return $this->headers ?? []; 100 100 } … … 121 121 } 122 122 123 public function jsonSerialize() {123 public function jsonSerialize(): array { 124 124 return get_object_vars( $this ); 125 125 } -
miqid-core/trunk/src/Classes/DTO/JWT.php
r2466954 r2480507 19 19 /** 20 20 * @param string|null $jwt 21 * 22 * @return JWT 21 23 */ 22 public function set_jwt( ?string $jwt ): void{24 public function set_jwt( ?string $jwt ): JWT { 23 25 $this->jwt = $jwt; 26 27 return $this; 24 28 } 25 29 … … 27 31 * @return string 28 32 */ 29 public function get_jwt() {33 public function get_jwt(): string { 30 34 return $this->jwt ?? ''; 31 35 } 32 36 33 public function jsonSerialize() {37 public function jsonSerialize(): array { 34 38 return get_object_vars( $this ); 35 39 } -
miqid-core/trunk/src/Classes/DTO/Login.php
r2466954 r2480507 62 62 } 63 63 64 public function jsonSerialize() { 65 $vars = get_object_vars( $this ); 66 67 return $vars; 64 public function jsonSerialize(): array { 65 return get_object_vars( $this ); 68 66 } 69 67 } -
miqid-core/trunk/src/Classes/DTO/MyBody.php
r2466954 r2480507 4 4 5 5 class MyBody extends Base { 6 /** @var int */6 /** @var int|null */ 7 7 private $NeckSize; 8 /** @var int */8 /** @var int|null */ 9 9 private $BreastSize; 10 /** @var int */10 /** @var int|null */ 11 11 private $WaistSize; 12 /** @var int */12 /** @var int|null */ 13 13 private $SeatWidth; 14 /** @var int */14 /** @var int|null */ 15 15 private $SweaterLength; 16 /** @var int */16 /** @var int|null */ 17 17 private $ShoulderWidth; 18 /** @var int */18 /** @var int|null */ 19 19 private $ArmLengthTight; 20 /** @var int */20 /** @var int|null */ 21 21 private $ArmLengthBent; 22 /** @var int */22 /** @var int|null */ 23 23 private $Wrist; 24 /** @var int */24 /** @var int|null */ 25 25 private $HipWidth; 26 /** @var int */26 /** @var int|null */ 27 27 private $StrideLength; 28 /** @var int */28 /** @var int|null */ 29 29 private $JacketLength; 30 /** @var int */30 /** @var int|null */ 31 31 private $ShoeSize; 32 /** @var int */32 /** @var int|null */ 33 33 private $FootLength; 34 34 35 public function __construct( 36 $NeckSize = null, 37 $BreastSize = null, 38 $WaistSize = null, 39 $SeatWidth = null, 40 $SweaterLength = null, 41 $ShoulderWidth = null, 42 $ArmLengthTight = null, 43 $ArmLengthBent = null, 44 $Wrist = null, 45 $HipWidth = null, 46 $StrideLength = null, 47 $JacketLength = null, 48 $ShoeSize = null, 49 $FootLength = null 50 ) { 51 if ( is_array( $NeckSize ) ) { 52 $this->parse_array( $NeckSize ); 53 } else { 54 $this->set_neck_size( $NeckSize ); 35 public function __construct( ?array $MyBody = null ) { 36 if ( is_array( $MyBody ) ) { 37 $this->parse_array( $MyBody ); 55 38 } 56 $this->set_breast_size( $BreastSize );57 $this->set_waist_size( $WaistSize );58 $this->set_seat_width( $SeatWidth );59 $this->set_sweater_length( $SweaterLength );60 $this->set_shoulder_width( $ShoulderWidth );61 $this->set_arm_length_tight( $ArmLengthTight );62 $this->set_arm_length_bent( $ArmLengthBent );63 $this->set_wrist( $Wrist );64 $this->set_hip_width( $HipWidth );65 $this->set_stride_length( $StrideLength );66 $this->set_jacket_length( $JacketLength );67 $this->set_shoe_size( $ShoeSize );68 $this->set_foot_length( $FootLength );69 39 } 70 40 71 41 /** 72 42 * @param int|null $NeckSize 73 */ 74 public function set_neck_size( ?int $NeckSize ): void { 75 $this->NeckSize = $NeckSize ?? $this->NeckSize; 43 * 44 * @return MyBody 45 */ 46 public function set_neck_size( ?int $NeckSize ): self { 47 $this->NeckSize = $NeckSize; 48 49 return $this; 50 51 } 52 53 /** 54 * @return int|null 55 */ 56 public function get_neck_size(): ?int { 57 return $this->NeckSize; 76 58 } 77 59 78 60 /** 79 61 * @param int|null $BreastSize 80 */ 81 public function set_breast_size( ?int $BreastSize ): void { 82 $this->BreastSize = $BreastSize ?? $this->BreastSize; 62 * 63 * @return MyBody 64 */ 65 public function set_breast_size( ?int $BreastSize ): self { 66 $this->BreastSize = $BreastSize; 67 68 return $this; 69 70 } 71 72 /** 73 * @return int|null 74 */ 75 public function get_breast_size(): ?int { 76 return $this->BreastSize; 83 77 } 84 78 85 79 /** 86 80 * @param int|null $WaistSize 87 */ 88 public function set_waist_size( ?int $WaistSize ): void { 89 $this->WaistSize = $WaistSize ?? $this->WaistSize; 81 * 82 * @return MyBody 83 */ 84 public function set_waist_size( ?int $WaistSize ): self { 85 $this->WaistSize = $WaistSize; 86 87 return $this; 88 89 } 90 91 /** 92 * @return int|null 93 */ 94 public function get_waist_size(): ?int { 95 return $this->WaistSize; 90 96 } 91 97 92 98 /** 93 99 * @param int|null $SeatWidth 94 */ 95 public function set_seat_width( ?int $SeatWidth ): void { 96 $this->SeatWidth = $SeatWidth ?? $this->SeatWidth; 100 * 101 * @return MyBody 102 */ 103 public function set_seat_width( ?int $SeatWidth ): self { 104 $this->SeatWidth = $SeatWidth; 105 106 return $this; 107 108 } 109 110 /** 111 * @return int|null 112 */ 113 public function get_seat_width(): ?int { 114 return $this->SeatWidth; 97 115 } 98 116 99 117 /** 100 118 * @param int|null $SweaterLength 101 */ 102 public function set_sweater_length( ?int $SweaterLength ): void { 103 $this->SweaterLength = $SweaterLength ?? $this->SweaterLength; 119 * 120 * @return MyBody 121 */ 122 public function set_sweater_length( ?int $SweaterLength ): self { 123 $this->SweaterLength = $SweaterLength; 124 125 return $this; 126 127 } 128 129 /** 130 * @return int|null 131 */ 132 public function get_sweater_length(): ?int { 133 return $this->SweaterLength; 104 134 } 105 135 106 136 /** 107 137 * @param int|null $ShoulderWidth 108 */ 109 public function set_shoulder_width( ?int $ShoulderWidth ): void { 110 $this->ShoulderWidth = $ShoulderWidth ?? $this->ShoulderWidth; 138 * 139 * @return MyBody 140 */ 141 public function set_shoulder_width( ?int $ShoulderWidth ): self { 142 $this->ShoulderWidth = $ShoulderWidth; 143 144 return $this; 145 146 } 147 148 /** 149 * @return int|null 150 */ 151 public function get_shoulder_width(): ?int { 152 return $this->ShoulderWidth; 111 153 } 112 154 113 155 /** 114 156 * @param int|null $ArmLengthTight 115 */ 116 public function set_arm_length_tight( ?int $ArmLengthTight ): void { 117 $this->ArmLengthTight = $ArmLengthTight ?? $this->ArmLengthTight; 157 * 158 * @return MyBody 159 */ 160 public function set_arm_length_tight( ?int $ArmLengthTight ): self { 161 $this->ArmLengthTight = $ArmLengthTight; 162 163 return $this; 164 165 } 166 167 /** 168 * @return int|null 169 */ 170 public function get_arm_length_tight(): ?int { 171 return $this->ArmLengthTight; 118 172 } 119 173 120 174 /** 121 175 * @param int|null $ArmLengthBent 122 */ 123 public function set_arm_length_bent( ?int $ArmLengthBent ): void { 124 $this->ArmLengthBent = $ArmLengthBent ?? $this->ArmLengthBent; 176 * 177 * @return MyBody 178 */ 179 public function set_arm_length_bent( ?int $ArmLengthBent ): self { 180 $this->ArmLengthBent = $ArmLengthBent; 181 182 return $this; 183 184 } 185 186 /** 187 * @return int|null 188 */ 189 public function get_arm_length_bent(): ?int { 190 return $this->ArmLengthBent; 125 191 } 126 192 127 193 /** 128 194 * @param int|null $Wrist 129 */ 130 public function set_wrist( ?int $Wrist ): void { 131 $this->Wrist = $Wrist ?? $this->Wrist; 195 * 196 * @return MyBody 197 */ 198 public function set_wrist( ?int $Wrist ): self { 199 $this->Wrist = $Wrist; 200 201 return $this; 202 203 } 204 205 /** 206 * @return int|null 207 */ 208 public function get_wrist(): ?int { 209 return $this->Wrist; 132 210 } 133 211 134 212 /** 135 213 * @param int|null $HipWidth 136 */ 137 public function set_hip_width( ?int $HipWidth ): void { 138 $this->HipWidth = $HipWidth ?? $this->HipWidth; 214 * 215 * @return MyBody 216 */ 217 public function set_hip_width( ?int $HipWidth ): self { 218 $this->HipWidth = $HipWidth; 219 220 return $this; 221 222 } 223 224 /** 225 * @return int|null 226 */ 227 public function get_hip_width(): ?int { 228 return $this->HipWidth; 139 229 } 140 230 141 231 /** 142 232 * @param int|null $StrideLength 143 */ 144 public function set_stride_length( ?int $StrideLength ): void { 145 $this->StrideLength = $StrideLength ?? $this->StrideLength; 233 * 234 * @return MyBody 235 */ 236 public function set_stride_length( ?int $StrideLength ): self { 237 $this->StrideLength = $StrideLength; 238 239 return $this; 240 241 } 242 243 /** 244 * @return int|null 245 */ 246 public function get_stride_length(): ?int { 247 return $this->StrideLength; 146 248 } 147 249 148 250 /** 149 251 * @param int|null $JacketLength 150 */ 151 public function set_jacket_length( ?int $JacketLength ): void { 152 $this->JacketLength = $JacketLength ?? $this->JacketLength; 252 * 253 * @return MyBody 254 */ 255 public function set_jacket_length( ?int $JacketLength ): self { 256 $this->JacketLength = $JacketLength; 257 258 return $this; 259 260 } 261 262 /** 263 * @return int|null 264 */ 265 public function get_jacket_length(): ?int { 266 return $this->JacketLength; 153 267 } 154 268 155 269 /** 156 270 * @param int|null $ShoeSize 157 */ 158 public function set_shoe_size( ?int $ShoeSize ): void { 159 $this->ShoeSize = $ShoeSize ?? $this->ShoeSize; 271 * 272 * @return MyBody 273 */ 274 public function set_shoe_size( ?int $ShoeSize ): self { 275 $this->ShoeSize = $ShoeSize; 276 277 return $this; 278 279 } 280 281 /** 282 * @return int|null 283 */ 284 public function get_shoe_size(): ?int { 285 return $this->ShoeSize; 160 286 } 161 287 162 288 /** 163 289 * @param int|null $FootLength 164 */ 165 public function set_foot_length( ?int $FootLength ): void { 166 $this->FootLength = $FootLength ?? $this->FootLength; 167 } 168 169 /** 170 * @return int 171 */ 172 public function get_neck_size(): int { 173 return $this->NeckSize ?? 0; 174 } 175 176 /** 177 * @return int 178 */ 179 public function get_breast_size(): int { 180 return $this->BreastSize ?? 0; 181 } 182 183 /** 184 * @return int 185 */ 186 public function get_waist_size(): int { 187 return $this->WaistSize ?? 0; 188 } 189 190 /** 191 * @return int 192 */ 193 public function get_seat_width(): int { 194 return $this->SeatWidth ?? 0; 195 } 196 197 /** 198 * @return int 199 */ 200 public function get_sweater_length(): int { 201 return $this->SweaterLength ?? 0; 202 } 203 204 /** 205 * @return int 206 */ 207 public function get_shoulder_width(): int { 208 return $this->ShoulderWidth ?? 0; 209 } 210 211 /** 212 * @return int 213 */ 214 public function get_arm_length_tight(): int { 215 return $this->ArmLengthTight ?? 0; 216 } 217 218 /** 219 * @return int 220 */ 221 public function get_arm_length_bent(): int { 222 return $this->ArmLengthBent ?? 0; 223 } 224 225 /** 226 * @return int 227 */ 228 public function get_wrist(): int { 229 return $this->Wrist ?? 0; 230 } 231 232 /** 233 * @return int 234 */ 235 public function get_hip_width(): int { 236 return $this->HipWidth ?? 0; 237 } 238 239 /** 240 * @return int 241 */ 242 public function get_stride_length(): int { 243 return $this->StrideLength ?? 0; 244 } 245 246 /** 247 * @return int 248 */ 249 public function get_jacket_length(): int { 250 return $this->JacketLength ?? 0; 251 } 252 253 /** 254 * @return int 255 */ 256 public function get_shoe_size(): int { 257 return $this->ShoeSize ?? 0; 258 } 259 260 /** 261 * @return int 262 */ 263 public function get_foot_length(): int { 264 return $this->FootLength ?? 0; 265 } 266 267 public function jsonSerialize() { 290 * 291 * @return MyBody 292 */ 293 public function set_foot_length( ?int $FootLength ): self { 294 $this->FootLength = $FootLength; 295 296 return $this; 297 298 } 299 300 /** 301 * @return int|null 302 */ 303 public function get_foot_length(): ?int { 304 return $this->FootLength; 305 } 306 307 public function jsonSerialize(): array { 268 308 return get_object_vars( $this ); 269 309 } -
miqid-core/trunk/src/Classes/DTO/Profile.php
r2474729 r2480507 4 4 5 5 use DateTime; 6 use MIQID\Plugin\Core\Classes\Utilities\SexType;7 6 8 7 class Profile extends Base { … … 17 16 /** @var DateTime */ 18 17 private $DateOfBirth; 19 /** @var SexType*/18 /** @var string|null */ 20 19 private $SexType; 21 20 /** @var string */ … … 32 31 private $Verified; 33 32 34 public function __construct( 35 $Email = null, 36 $FirstName = null, 37 $LastName = null, 38 $LegalName = null, 39 $DateOfBirth = null, 40 $SexType = null, 41 $PhoneNumber = null, 42 $Country = null, 43 $Nationality = null, 44 $BlobPictureName = null, 45 $ContractbookDocumentId = null, 46 $Verified = null 47 ) { 33 public function __construct( ?array $Profile = null ) { 48 34 __( 'Profile', 'miqid-core' ); 49 35 __( 'Email', 'miqid-core' ); … … 58 44 __( 'Verified', 'miqid-core' ); 59 45 60 if ( is_array( $Email ) ) { 61 $this->parse_array( $Email ); 62 } else { 63 $this->set_email( $Email ); 46 if ( is_array( $Profile ) ) { 47 $this->parse_array( $Profile ); 64 48 } 65 $this->set_first_name( $FirstName );66 $this->set_last_name( $LastName );67 $this->set_legal_name( $LegalName );68 $this->set_date_of_birth( $DateOfBirth );69 $this->set_sex_type( $SexType );70 $this->set_phone_number( $PhoneNumber );71 $this->set_country( $Country );72 $this->set_nationality( $Nationality );73 $this->set_blob_picture_name( $BlobPictureName );74 $this->set_contractbook_document_id( $ContractbookDocumentId );75 $this->set_verified( $Verified );76 49 } 77 50 … … 115 88 116 89 /** 117 * @param int|SexType|null $SexType 118 */ 119 public function set_sex_type( $SexType ): void { 120 if ( is_int( $SexType ) ) { 121 $SexType = new SexType( $SexType ); 122 } 123 124 $this->SexType = $SexType ?? $this->SexType; 90 * @param string|null $SexType 91 */ 92 public function set_sex_type( ?string $SexType ): void { 93 $this->SexType = $SexType; 125 94 } 126 95 … … 189 158 } 190 159 191 public function get_full_name() {160 public function get_full_name(): string { 192 161 return implode( ' ', array_filter( [ $this->get_first_name(), $this->get_last_name() ] ) ); 193 162 } … … 201 170 202 171 /** 172 * @param null $format 173 * 203 174 * @return DateTime|string|null 204 175 */ … … 212 183 213 184 /** 214 * @return SexType215 */ 216 public function get_sex_type(): SexType{217 return $this->SexType ?? new SexType();185 * @return string|null 186 */ 187 public function get_sex_type(): ?string { 188 return $this->SexType; 218 189 } 219 190 … … 261 232 262 233 263 public function jsonSerialize() {234 public function jsonSerialize(): array { 264 235 $arr = get_object_vars( $this ); 265 236 $arr['DateOfBirth'] = $this->get_date_of_birth( 'c' ); 266 $arr['SexType'] = $this->get_sex_type()->get_sex_type();267 237 268 238 return $arr; -
miqid-core/trunk/src/Classes/DTO/ProfilePicture.php
r2466954 r2480507 9 9 } 10 10 11 public function jsonSerialize() {11 public function jsonSerialize(): array { 12 12 return array_merge( 13 13 get_object_vars( $this ), -
miqid-core/trunk/src/Classes/DTO/SignUp.php
r2466954 r2480507 20 20 * @param int|null $sexType 21 21 * @param string|null $nationality 22 * 23 * @noinspection PhpMissingParentConstructorInspection 22 24 */ 23 25 public function __construct( $email = null, $password = null, $firstName = null, $lastName = null, $dateOfBirth = null, $phoneNumber = null, $sexType = null, $nationality = null ) { … … 46 48 } 47 49 48 public function jsonSerialize() {50 public function jsonSerialize(): array { 49 51 $arr = array_merge( 50 52 get_object_vars( $this ), … … 52 54 ); 53 55 54 unset( $arr['legalName']);55 unset( $arr['country']);56 unset( $arr['blobPictureName']);57 unset( $arr['contractbookDocumentId']);58 unset( $arr['verified']);56 unset( $arr['legalName'] ); 57 unset( $arr['country'] ); 58 unset( $arr['blobPictureName'] ); 59 unset( $arr['contractbookDocumentId'] ); 60 unset( $arr['verified'] ); 59 61 60 62 return $arr; -
miqid-core/trunk/src/Classes/Feature.php
r2467105 r2480507 6 6 7 7 class Feature extends Base { 8 /** @var string|null */ 9 private $JWT; 8 10 /** @var bool */ 9 11 private $user_switching_enabled; 10 12 11 public function __construct( 12 $user_switching_enabled = null 13 ) { 14 if ( is_array( $user_switching_enabled ) ) { 15 $this->parse_array( $user_switching_enabled ); 16 } 17 18 if ( isset( $user_switching_enabled ) ) { 19 $this->set_user_switching_enabled( $user_switching_enabled ); 13 public function __construct( ?array $Feature = null ) { 14 if ( is_array( $Feature ) ) { 15 $this->parse_array( $Feature ); 20 16 } 21 17 } 22 18 23 19 /** 24 * @param bool|int|string $user_switching_enabled 20 * @param string|null $JWT 21 */ 22 public function set_JWT( ?string $JWT ): void { 23 $this->JWT = $JWT; 24 } 25 26 /** 27 * @return string|null 28 */ 29 public function get_JWT(): ?string { 30 return $this->JWT; 31 } 32 33 /** 34 * @param bool|int|string|null $user_switching_enabled 25 35 */ 26 36 public function set_user_switching_enabled( $user_switching_enabled ): void { 27 $this->user_switching_enabled = filter_var( $user_switching_enabled, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) ?? false; 37 if ( ! is_null( $user_switching_enabled ) ) { 38 $user_switching_enabled = filter_var( $user_switching_enabled, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ); 39 } 40 $this->user_switching_enabled = $user_switching_enabled; 28 41 } 29 42 … … 35 48 } 36 49 37 public function jsonSerialize() {50 public function jsonSerialize(): array { 38 51 return get_object_vars( $this ); 39 52 } -
miqid-core/trunk/src/Frontend/Ajax/Ajax.php
r2474729 r2480507 6 6 private static $instance; 7 7 8 static function Instance() {8 static function Instance(): self { 9 9 if ( is_null( self::$instance ) ) { 10 10 self::$instance = new self(); -
miqid-core/trunk/src/Frontend/Ajax/CompanyProfile.php
r2474729 r2480507 3 3 namespace MIQID\Plugin\Core\Frontend\Ajax; 4 4 5 use MIQID\Plugin\Core\Classes\DTO\{CompanyProfile as dtoCompanyProfile, HttpResponse}; 5 use MIQID\Plugin\Core\Classes\DTO\{HttpResponse}; 6 use MIQID\Plugin\Core\Classes\API\Business\Profile; 6 7 use MIQID\Plugin\Core\Util; 7 8 8 class CompanyProfile extends \MIQID\Plugin\Core\Classes\API\CompanyProfile {9 class CompanyProfile extends Profile { 9 10 private static $instance; 10 11 private $CompanyProfile; … … 18 19 } 19 20 21 /** @noinspection PhpMissingParentConstructorInspection */ 20 22 private function __construct() { 21 23 add_action( 'wp_ajax_miqid_companyprofile', [ $this, '_ajax' ] ); … … 23 25 } 24 26 25 function GetProfile( $profileId, $JWT = null ) { 26 $miqid_kyc = get_option( 'miqid-kyc' ); 27 27 function GetProfile( $profileId ) { 28 28 if ( is_null( $this->CompanyProfile[ $profileId ] ) ) { 29 $this->CompanyProfile[ $profileId ] = parent::GetProfile( $profileId, $miqid_kyc['token'] ?? '' ); 30 } 31 32 if ( $this->CompanyProfile[ $profileId ] instanceof HttpResponse ) { 33 $this->CompanyProfile[ $profileId ] = new dtoCompanyProfile(); 29 if ( ( $this->CompanyProfile[ $profileId ] = parent::GetProfile( $profileId ) ) && $this->CompanyProfile[ $profileId ] instanceof HttpResponse ) { 30 $this->CompanyProfile[ $profileId ] = new \MIQID\Plugin\Core\Classes\DTO\Business\Profile(); 31 } 34 32 } 35 33 -
miqid-core/trunk/src/Frontend/Frontend.php
r2474729 r2480507 5 5 6 6 use MIQID\Plugin\Core\Frontend\Ajax\Ajax; 7 use MIQID\Plugin\Core\Frontend\Filter\Filter;8 7 use MIQID\Plugin\Core\Frontend\Shortcode\Shortcode; 9 8 use MIQID\Plugin\Core\Util; … … 29 28 Ajax::Instance(); 30 29 31 Filter::Instance();32 33 30 Shortcode::Instance(); 34 31 -
miqid-core/trunk/src/Frontend/Shortcode/Login.php
r2466954 r2480507 4 4 5 5 use MIQID\Plugin\Core\Classes\API\{Authentication, Profile}; 6 use MIQID\Plugin\Core\Classes\DTO\{ HttpResponse,JWT, Profile as dtoProfile};6 use MIQID\Plugin\Core\Classes\DTO\{JWT, Profile as dtoProfile}; 7 7 use MIQID\Plugin\Core\Util; 8 8 … … 25 25 } 26 26 27 function _miqid_login( $atts ) {27 function _miqid_login( $atts ): string { 28 28 $atts = array_change_key_case( (array) $atts, CASE_LOWER ); 29 29 $atts = shortcode_atts( [ … … 36 36 'logged_in' => __( 'Du er allerede logget ind' ), 37 37 ], $atts ); 38 39 $JWT = Util::get_user_jwt();40 38 41 39 if ( ( $Profile = Profile::Instance()->GetProfile() ) && $Profile instanceof dtoProfile ) { -
miqid-core/trunk/src/Frontend/Shortcode/MIQID.php
r2466997 r2480507 8 8 private static $instance; 9 9 10 static function Instance() {10 static function Instance(): self { 11 11 if ( is_null( self::$instance ) ) { 12 12 self::$instance = new self(); … … 20 20 } 21 21 22 function _miqid( $atts ) {22 function _miqid( $atts ): string { 23 23 $atts = array_change_key_case( (array) $atts, CASE_LOWER ); 24 24 $atts = shortcode_atts( [ -
miqid-core/trunk/src/Frontend/Shortcode/Shortcode.php
r2466997 r2480507 2 2 3 3 namespace MIQID\Plugin\Core\Frontend\Shortcode; 4 5 use MIQID\Plugin\Core\Frontend\Shortcode\Business\{Kyc as businessKyc, MyBody as businessMyBody, Profile as businessProfile, UserAddress as businessAddress}; 4 6 5 7 class Shortcode { … … 17 19 Login::Instance(); 18 20 MIQID::Instance(); 21 22 Address::Instance(); 23 MyBody::Instance(); 24 Profile::Instance(); 25 26 businessKyc::Instance(); 27 businessMyBody::Instance(); 28 businessProfile::Instance(); 29 businessAddress::Instance(); 30 } 31 32 /** 33 * @param array $atts 34 * @param array $fields 35 * @param mixed $data 36 * 37 * @return array 38 */ 39 public static function Shortcode_Output( array $atts, array $fields, $data ): array { 40 $output = []; 41 foreach ( array_filter( explode( ';', $atts['fields'] ) ) as $field ) { 42 $field_arr = explode( '|', $field ); 43 $field = array_shift( $field_arr ); 44 $ending = array_shift( $field_arr ); 45 if ( array_key_exists( $field, $fields ) ) { 46 $sField = $fields[ $field ]; 47 if ( ( $func = sprintf( 'get_%s', $sField ) ) && method_exists( $data, $func ) ) { 48 $output[ $field ] = $data->$func(); 49 } else if ( ( $func = sprintf( 'is_%s', $sField ) ) && method_exists( $data, $func ) ) { 50 $output[ $field ] = sprintf( '%s', $data->$func() ? __( $field, 'miqid-core' ) : sprintf( __( 'Not %s' ), __( $field, 'miqid-core' ) ) ); 51 } 52 53 if ( $output[ $field ] instanceof \DateTime ) { 54 $output[ $field ] = sprintf( '%s %s', 55 $output[ $field ]->format( get_option( 'date_format' ) ), 56 $output[ $field ]->format( get_option( 'time_format' ) ), 57 ); 58 } 59 60 if ( isset( $output[ $field ] ) ) { 61 $output[ $field ] = sprintf( '%s%s', $output[ $field ], $ending ); 62 } 63 64 } 65 } 66 67 return $output; 19 68 } 20 69 } -
miqid-core/trunk/src/Frontend/User_Switching.php
r2466954 r2480507 94 94 * @return bool Whether the current user is being 'remembered'. 95 95 */ 96 public function remember() {96 public function remember(): bool { 97 97 /** This filter is documented in wp-includes/pluggable.php */ 98 98 $cookie_life = apply_filters( 'auth_cookie_expiration', 172800, get_current_user_id(), false ); … … 175 175 if ( ! empty( $_REQUEST['interim-login'] ) ) { 176 176 $GLOBALS['interim_login'] = 'success'; // @codingStandardsIgnoreLine 177 login_header( '' , '');177 login_header( '' ); 178 178 exit; 179 179 } … … 235 235 * @return string The URL to redirect to. 236 236 */ 237 protected function get_redirect( WP_User $new_user = null, WP_User $old_user = null ) {237 protected function get_redirect( WP_User $new_user = null, WP_User $old_user = null ): string { 238 238 if ( ! empty( $_REQUEST['redirect_to'] ) ) { 239 239 $redirect_to = self::remove_query_args( wp_unslash( $_REQUEST['redirect_to'] ) ); … … 256 256 257 257 258 259 258 /** 260 259 * Validates the old user cookie and returns its user data. … … 282 281 * @return bool Whether verification with the auth cookie passed. 283 282 */ 284 public function authenticate_old_user( WP_User $user ) {283 public function authenticate_old_user( WP_User $user ): bool { 285 284 $cookie = self::user_switching_get_auth_cookie(); 286 285 if ( ! empty( $cookie ) ) { … … 457 456 * @return string The login screen message. 458 457 */ 459 public function filter_login_message( $message ){458 public function filter_login_message( string $message ): string { 460 459 $old_user = self::get_old_user(); 461 460 … … 567 566 * @return string[] Updated array of removable query arguments. 568 567 */ 569 public function filter_removable_query_args( array $args ) {568 public function filter_removable_query_args( array $args ): array { 570 569 return array_merge( $args, [ 571 570 'user_switched', … … 601 600 * @return string The required URL. 602 601 */ 603 public function switch_to_url( WP_User $user ) {602 public function switch_to_url( WP_User $user ): string { 604 603 return wp_nonce_url( add_query_arg( [ 605 604 'action' => 'switch_to_user', … … 616 615 * @return string The required URL. 617 616 */ 618 public function switch_back_url( WP_User $user ) {617 public function switch_back_url( WP_User $user ): string { 619 618 return wp_nonce_url( add_query_arg( [ 620 619 'action' => 'switch_to_olduser', … … 630 629 * @return string The required URL. 631 630 */ 632 public function switch_off_url( WP_User $user ) {631 public function switch_off_url( WP_User $user ): string { 633 632 return wp_nonce_url( add_query_arg( [ 634 633 'action' => 'switch_off', … … 642 641 * @return string The current URL. 643 642 */ 644 public function current_url() {643 public function current_url(): string { 645 644 return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 646 645 } … … 653 652 * @return string The URL with query args removed. 654 653 */ 655 public function remove_query_args( $url ){654 public function remove_query_args( string $url ): string { 656 655 if ( function_exists( 'wp_removable_query_args' ) ) { 657 656 $url = remove_query_arg( wp_removable_query_args(), $url ); … … 670 669 * @return bool Should the old user cookie be secure? 671 670 */ 672 public function secure_olduser_cookie() {671 public function secure_olduser_cookie(): bool { 673 672 return ( is_ssl() && ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ) ); 674 673 } … … 681 680 * @return bool Whether the auth cookie should be secure. 682 681 */ 683 public function secure_auth_cookie() {682 public function secure_auth_cookie(): bool { 684 683 return ( is_ssl() && ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ) ); 685 684 } … … 731 730 * @return bool[] Array of concerned user's capabilities. 732 731 */ 733 public function filter_user_has_cap( array $user_caps, array $required_caps, array $args, WP_User $user ) {732 public function filter_user_has_cap( array $user_caps, array $required_caps, array $args, WP_User $user ): array { 734 733 if ( 'switch_to_user' === $args[0] ) { 735 734 if ( empty( $args[2] ) ) { … … 775 774 * @return string[] Array of required capabilities for the requested action. 776 775 */ 777 public function filter_map_meta_cap( array $required_caps, string $cap, int $user_id, array $args ) {776 public function filter_map_meta_cap( array $required_caps, string $cap, int $user_id, array $args ): array { 778 777 if ( 'switch_to_user' === $cap ) { 779 778 if ( empty( $args[0] ) || $args[0] === $user_id ) { … … 925 924 * @return string[] Array of originating user authentication cookie values. Empty array if there are none. 926 925 */ 927 function user_switching_get_auth_cookie() {926 function user_switching_get_auth_cookie(): array { 928 927 if ( user_switching::secure_auth_cookie() ) { 929 928 $auth_cookie_name = USER_SWITCHING_SECURE_COOKIE; … … 951 950 * @return false|WP_User WP_User object on success, false on failure. 952 951 */ 953 function switch_to_user( $user_id, $remember = false, $set_old_user = true ) {952 function switch_to_user( int $user_id, $remember = false, $set_old_user = true ) { 954 953 $user = get_userdata( $user_id ); 955 954 … … 1044 1043 * @return bool True on success, false on failure. 1045 1044 */ 1046 function switch_off_user() {1045 function switch_off_user(): bool { 1047 1046 $old_user_id = get_current_user_id(); 1048 1047 -
miqid-core/trunk/src/Frontend/WP_Login.php
r2475424 r2480507 10 10 private static $_instance; 11 11 12 public static function Instance() {12 public static function Instance(): self { 13 13 if ( is_null( self::$_instance ) ) { 14 14 self::$_instance = new self(); … … 69 69 ?> 70 70 <!DOCTYPE html> 71 <html <?php language_attributes( 'html') ?>>71 <html <?php language_attributes() ?>> 72 72 <head> 73 73 <title><?= __( 'MIQID Login' ) ?></title> … … 192 192 193 193 #loginform #miqid_login #miqid_button_login { 194 background-image: url('<?=Util::get_assets_images_url()?>/ MIQID-Logo.svg');194 background-image: url('<?=Util::get_assets_images_url()?>/miqid-logo.svg'); 195 195 background-position: center; 196 196 background-repeat: no-repeat; -
miqid-core/trunk/src/Util.php
r2467105 r2480507 3 3 namespace MIQID\Plugin\Core; 4 4 5 use MIQID\Plugin\Core\Classes\DTO\HttpResponse; 6 use MIQID\Plugin\Core\Classes\DTO\JWT; 5 use MIQID\Plugin\Core\Classes\DTO\{HttpResponse, JWT}; 7 6 use MIQID\Plugin\Core\Classes\Feature; 8 7 … … 12 11 * @return JWT 13 12 */ 14 public static function get_user_jwt() {13 public static function get_user_jwt(): JWT { 15 14 $user = wp_get_current_user(); 16 15 … … 38 37 } 39 38 40 public static function get_assets_css_url() {39 public static function get_assets_css_url(): string { 41 40 return sprintf( '%s/%s', self::get_plugin_dir_url(), 'assets/css' ); 42 41 } 43 42 44 public static function get_assets_images_url() {43 public static function get_assets_images_url(): string { 45 44 return sprintf( '%s/%s', self::get_plugin_dir_url(), 'assets/images' ); 46 45 } 47 46 48 public static function get_assets_js_url() {47 public static function get_assets_js_url(): string { 49 48 return sprintf( '%s/%s', self::get_plugin_dir_url(), 'assets/js' ); 50 49 } 51 50 52 public static function get_assets_css_path() {51 public static function get_assets_css_path(): string { 53 52 return sprintf( '%s/%s', self::get_plugin_dir_path(), 'assets/css' ); 54 53 } 55 54 56 public static function get_assets_images_path() {55 public static function get_assets_images_path(): string { 57 56 return sprintf( '%s/%s', self::get_plugin_dir_path(), 'assets/images' ); 58 57 } 59 58 60 public static function get_assets_js_path() {59 public static function get_assets_js_path(): string { 61 60 return sprintf( '%s/%s', self::get_plugin_dir_path(), 'assets/js' ); 62 61 } 63 62 64 public static function get_plugin_dir_url() {63 public static function get_plugin_dir_url(): string { 65 64 return plugins_url( '', __DIR__ ); 66 65 } 67 66 68 public static function get_plugin_dir_path() {67 public static function get_plugin_dir_path(): string { 69 68 return dirname( __DIR__ ); 70 69 } 71 70 72 public static function snake_case( $str ) {71 public static function snake_case( $str ): string { 73 72 return strtolower( strtr( 74 73 preg_replace( [ '/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/' ], '$1_$2', $str ), [ … … 78 77 79 78 /** @return Feature */ 80 public static function get_miqid_core_feature() {79 public static function get_miqid_core_feature(): Feature { 81 80 $feature = get_option( 'miqid-core', [] ); 82 81 if ( $feature instanceof Feature ) {
Note: See TracChangeset
for help on using the changeset viewer.