PATH:
home
/
letacommog
/
camarsac
/
wp-content
/
plugins
/
jet-engine
/
includes
/
modules
/
data-stores
/
inc
/
stores
<?php namespace Jet_Engine\Modules\Data_Stores\Stores; class User_Meta_Store extends Base_Store { /** * Store type ID */ public function type_id() { return 'user-meta'; } /** * Store type name */ public function type_name() { return __( 'User Metadata', 'jet-engine' ); } /** * Add to store callback */ public function add_to_store( $store_id, $post_id ) { if ( ! is_user_logged_in() ) { return; } $store = $this->get( $store_id ); if ( ! in_array( $post_id, $store ) ) { $store[] = ( string ) $post_id; } $count = count( $store ); $this->set_store( $store_id, $store ); return $count; } /** * Add to store callback */ public function remove( $store_id, $post_id ) { if ( ! is_user_logged_in() ) { return; } $store = $this->get( $store_id ); if ( false !== ( $index = array_search( $post_id, $store ) ) ) { unset( $store[ $index ] ); } $count = count( $store ); $this->set_store( $store_id, $store ); return $count; } public function set_store( $store_id, $store ) { $user_id = get_current_user_id(); update_user_meta( $user_id, $this->prefix . $store_id, $store ); } /** * Get post IDs from store */ public function get( $store_id ) { if ( ! is_user_logged_in() ) { return array(); } $user_id = get_current_user_id(); $store = get_user_meta( $user_id, $this->prefix . $store_id, true ); if ( empty( $store ) ) { $store = array(); } return $store; } }
[+]
..
[-] manager.php
[edit]
[-] base.php
[edit]
[-] session.php
[edit]
[-] on-view.php
[edit]
[-] factory.php
[edit]
[-] local-storage.php
[edit]
[-] user-meta.php
[edit]
[-] cookies.php
[edit]