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