1
|
|
|
<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2
|
|
|
/** |
3
|
|
|
* Event Espresso |
4
|
|
|
* |
5
|
|
|
* Event Registration and Management Plugin for WordPress |
6
|
|
|
* |
7
|
|
|
* @ package Event Espresso |
8
|
|
|
* @ author Seth Shoultes |
9
|
|
|
* @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
10
|
|
|
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
11
|
|
|
* @ link http://www.eventespresso.com |
12
|
|
|
* @ version 4.0 |
13
|
|
|
* |
14
|
|
|
* ------------------------------------------------------------------------ |
15
|
|
|
* |
16
|
|
|
* Post Meta Model |
17
|
|
|
* |
18
|
|
|
* Model for accessing the wp core postmeta table. Generally it's better to use the |
19
|
|
|
* built-in wp functions directly, but this is useful if you want to use the EE models |
20
|
|
|
* and need a query that factors in an EE custom post type's postmeta (eg, attendees, events or venues). |
21
|
|
|
* Currently, if applying caps to the queries, these are only accessible to site admins; |
22
|
|
|
* however we may devise some strategy for marking specified postmetas as public. |
23
|
|
|
* (Using the wp core convention of prefixing meta keys with an underscore might work, |
24
|
|
|
* see https://codex.wordpress.org/Function_Reference/add_post_meta, but when a postmeta is |
25
|
|
|
* "non-hidden" it's meant to show in the wp admin's post editing page, not necessarily on the frontend) |
26
|
|
|
* |
27
|
|
|
* |
28
|
|
|
* @package Event Espresso |
29
|
|
|
* @subpackage includes/models/ |
30
|
|
|
* @author Michael Nelson |
31
|
|
|
* |
32
|
|
|
* ------------------------------------------------------------------------ |
33
|
|
|
*/ |
34
|
|
|
require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
35
|
|
|
|
36
|
|
|
class EEM_Post_Meta extends EEM_Base { |
37
|
|
|
|
38
|
|
|
// private instance of the EE_Post_Meta object |
39
|
|
|
protected static $_instance = NULL; |
40
|
|
|
|
41
|
|
|
protected function __construct( $timezone = NULL ) { |
42
|
|
|
$this->singular_item = __('Post Meta','event_espresso'); |
43
|
|
|
$this->plural_item = __('Post Metas','event_espresso'); |
44
|
|
|
$this->_tables = array( |
|
|
|
|
45
|
|
|
'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id') |
46
|
|
|
); |
47
|
|
|
$models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() ); |
48
|
|
|
$this->_fields = array( |
|
|
|
|
49
|
|
|
'Post_Meta'=>array( |
50
|
|
|
'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")), |
51
|
|
|
'post_id'=>new EE_Foreign_Key_Int_Field('post_id', __("Primary Key of Post", "event_espresso"), false, 0, $models_this_can_attach_to), |
|
|
|
|
52
|
|
|
'meta_key'=>new EE_Plain_Text_Field('meta_key', __("Meta Key", "event_espresso"), false, ''), |
53
|
|
|
'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true) |
54
|
|
|
)); |
55
|
|
|
$this->_model_relations = array(); |
56
|
|
|
foreach($models_this_can_attach_to as $model){ |
57
|
|
|
$this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
58
|
|
|
} |
59
|
|
|
foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
60
|
|
|
$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' ); |
61
|
|
|
} |
62
|
|
|
parent::__construct( $timezone ); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
} |
67
|
|
|
// End of file EEM_Post_Meta.model.php |
68
|
|
|
// Location: /includes/models/EEM_Post_Meta.model.php |
69
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..