AudioPreset.php
1 month ago
Block.php
9 months ago
CurrentUser.php
1 year ago
EmailCollection.php
1 year ago
Model.php
3 months ago
ModelInterface.php
1 year ago
Player.php
1 year ago
Post.php
1 year ago
Preset.php
1 month ago
ReusableVideo.php
1 month ago
Setting.php
1 year ago
Video.php
1 month ago
Webhook.php
1 year ago
CurrentUser.php
24 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PrestoPlayer\Models; |
| 4 | |
| 5 | class CurrentUser extends \WP_User { |
| 6 | |
| 7 | public function __construct() { |
| 8 | $user = wp_get_current_user(); |
| 9 | return parent::__construct( $user->ID ); |
| 10 | } |
| 11 | |
| 12 | public static function getUser() { |
| 13 | return new self(); |
| 14 | } |
| 15 | |
| 16 | public static function getIP() { |
| 17 | return isset( $_SERVER['REMOTE_ADDR'] ) ? filter_var( wp_unslash( $_SERVER['REMOTE_ADDR'] ), FILTER_VALIDATE_IP ) : null; |
| 18 | } |
| 19 | |
| 20 | public static function canAccessVideo( $id ) { |
| 21 | return (bool) apply_filters( 'presto-player-show-private-video', is_user_logged_in(), $id ); |
| 22 | } |
| 23 | } |
| 24 |