csrf-token-model.php
3 years ago
csrf-token-view.php
3 years ago
csrf-tools.php
3 years ago
wp-nonce-tools.php
3 years ago
csrf-token-view.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Classes\Security; |
| 5 | |
| 6 | |
| 7 | use Jet_Form_Builder\Db_Queries\Views\View_Base; |
| 8 | use Jet_Form_Builder\Exceptions\Query_Builder_Exception; |
| 9 | |
| 10 | class Csrf_Token_View extends View_Base { |
| 11 | |
| 12 | /** |
| 13 | * @return string |
| 14 | */ |
| 15 | public function table(): string { |
| 16 | return Csrf_Token_Model::table(); |
| 17 | } |
| 18 | |
| 19 | public function select_columns(): array { |
| 20 | return Csrf_Token_Model::schema_columns(); |
| 21 | } |
| 22 | |
| 23 | public function get_dependencies(): array { |
| 24 | return array( |
| 25 | new Csrf_Token_Model(), |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @param string $client_id |
| 31 | * |
| 32 | * @return array |
| 33 | * @throws Query_Builder_Exception |
| 34 | */ |
| 35 | public static function by_client( string $client_id ): array { |
| 36 | return static::findOne( |
| 37 | array( |
| 38 | 'client_id' => $client_id, |
| 39 | ) |
| 40 | )->query()->query_one(); |
| 41 | } |
| 42 | |
| 43 | } |