| 1 |
<?php |
| 2 |
|
| 3 |
namespace Leadin\data; |
| 4 |
|
| 5 |
use Leadin\data\User; |
| 6 |
|
| 7 |
/** |
| 8 |
* Handles metadata for users in the admin area. |
| 9 |
*/ |
| 10 |
class User_Metadata { |
| 11 |
|
| 12 |
const SKIP_REVIEW = 'leadin_skip_review'; |
| 13 |
const REVIEW_BANNER_LAST_CALL = 'leadin_review_banner_last_call'; |
| 14 |
const HAS_MIN_CONTACTS = 'leadin_has_min_contacts'; |
| 15 |
const TRACK_CONSENT = 'leadin_track_consent'; |
| 16 |
const FIRST_NAME = 'first_name'; |
| 17 |
const NICKNAME = 'nickname'; |
| 18 |
|
| 19 |
|
| 20 |
/** |
| 21 |
* Get FIRST_NAME meta data for a user. |
| 22 |
*/ |
| 23 |
public static function get_first_name() { |
| 24 |
return User::get_metadata( self::FIRST_NAME ); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Get NICKNAME meta data for a user. |
| 29 |
*/ |
| 30 |
public static function get_nickname() { |
| 31 |
return User::get_metadata( self::NICKNAME ); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Set SKIP_REVIEW meta data for a user. |
| 36 |
* |
| 37 |
* @param int $skip_epoch Epoch time of when the review was skipped. |
| 38 |
*/ |
| 39 |
public static function set_skip_review( $skip_epoch ) { |
| 40 |
return User::set_metadata( self::SKIP_REVIEW, $skip_epoch ); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Get SKIP_REVIEW meta data for a user. |
| 45 |
*/ |
| 46 |
public static function get_skip_review() { |
| 47 |
return User::get_metadata( self::SKIP_REVIEW ); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Set REVIEW_BANNER_LAST_CALL meta data for a user. |
| 52 |
* |
| 53 |
* @param int $skip_epoch Epoch time of when the review was skipped. |
| 54 |
*/ |
| 55 |
public static function set_review_banner_last_call( $skip_epoch ) { |
| 56 |
return User::set_metadata( self::REVIEW_BANNER_LAST_CALL, $skip_epoch ); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Get REVIEW_BANNER_LAST_CALL meta data for a user. |
| 61 |
*/ |
| 62 |
public static function get_review_banner_last_call() { |
| 63 |
return User::get_metadata( self::REVIEW_BANNER_LAST_CALL ); |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* Set HAS_MIN_CONTACTS meta data for a user. |
| 68 |
* |
| 69 |
* @param bool $value Boolean to see if contacts already been fetched and fulfill threshold. |
| 70 |
*/ |
| 71 |
public static function set_has_min_contacts( $value ) { |
| 72 |
return User::set_metadata( self::HAS_MIN_CONTACTS, $value ); |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Get HAS_MIN_CONTACTS meta data for a user. |
| 77 |
*/ |
| 78 |
public static function get_has_min_contacts() { |
| 79 |
return User::get_metadata( self::HAS_MIN_CONTACTS ); |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* Set TRACK_CONSENT meta data for a user. |
| 84 |
* |
| 85 |
* @param bool $consent User consent to anonymous tracking. |
| 86 |
*/ |
| 87 |
public static function set_track_consent( $consent ) { |
| 88 |
return User::set_metadata( self::TRACK_CONSENT, $consent ); |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* Get TRACK_CONSENT meta data for a user. |
| 93 |
*/ |
| 94 |
public static function get_track_consent() { |
| 95 |
return User::get_metadata( self::TRACK_CONSENT ); |
| 96 |
} |
| 97 |
|
| 98 |
} |
| 99 |
|