Protecting class variables
This commit is contained in:
parent
f0f2b4aff9
commit
1650debab1
|
@ -9,6 +9,27 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
*/
|
||||
class Collection extends Entity {
|
||||
|
||||
protected
|
||||
$diplay_name,
|
||||
$full,
|
||||
$featured_img_id,
|
||||
$modification_date,
|
||||
$creation_date,
|
||||
$author_id,
|
||||
$url,
|
||||
$name,
|
||||
$slug,
|
||||
$order,
|
||||
$parent,
|
||||
$description,
|
||||
$default_order,
|
||||
$default_orderby,
|
||||
$columns,
|
||||
$default_view_mode,
|
||||
$fields_order,
|
||||
$filters_order,
|
||||
$moderators_ids;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Tainacan\Entities\Entity::post_type
|
||||
|
@ -160,8 +181,7 @@ class Collection extends Entity {
|
|||
return $attachments_prepared;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function get_author_name() {
|
||||
|
@ -185,10 +205,12 @@ class Collection extends Entity {
|
|||
/**
|
||||
* @return int|string
|
||||
*/
|
||||
|
||||
function get_featured_img_id() {
|
||||
if ( isset( $this->featured_img_id ) ) {
|
||||
return $this->featured_img_id;
|
||||
}
|
||||
$featured_img_id = $this->get_mapped_property("featured_img_id");
|
||||
if ( isset( $featured_img_id ) ) {
|
||||
return $featured_img_id;
|
||||
}
|
||||
|
||||
return get_post_thumbnail_id( $this->get_id() );
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ class Entity {
|
|||
if (isset($this->$prop) ){
|
||||
return $this->$prop;
|
||||
}
|
||||
|
||||
//prop is not set at object, try to get from database
|
||||
$repository = $this->get_repository();
|
||||
|
||||
|
@ -157,7 +158,7 @@ class Entity {
|
|||
$this->set_validated(false);
|
||||
$this->$prop = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set the status of the entity
|
||||
* @param string $value
|
||||
|
|
|
@ -8,7 +8,22 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
* Represents the Entity Field
|
||||
*/
|
||||
class Field extends Entity {
|
||||
|
||||
protected
|
||||
$name,
|
||||
$slug,
|
||||
$order,
|
||||
$parent,
|
||||
$description,
|
||||
$required,
|
||||
$multiple,
|
||||
$cardinality,
|
||||
$collection_key,
|
||||
$mask,
|
||||
$privacy,
|
||||
$default_value,
|
||||
$field_type,
|
||||
$field_type_options;
|
||||
|
||||
// Collection getter and setter declared here
|
||||
use \Tainacan\Traits\Entity_Collection_Relation;
|
||||
|
||||
|
|
|
@ -9,7 +9,16 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
*/
|
||||
class Filter extends Entity {
|
||||
use \Tainacan\Traits\Entity_Collection_Relation;
|
||||
|
||||
|
||||
protected
|
||||
$name,
|
||||
$description,
|
||||
$order,
|
||||
$color,
|
||||
$field,
|
||||
$filter_type,
|
||||
$filter_type_options;
|
||||
|
||||
protected static $post_type = 'tainacan-filter';
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,22 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
*/
|
||||
class Item extends Entity {
|
||||
use \Tainacan\Traits\Entity_Collection_Relation;
|
||||
protected
|
||||
$terms,
|
||||
$diplay_name,
|
||||
$full,
|
||||
$featured_img_id,
|
||||
$modification_date,
|
||||
$creation_date,
|
||||
$author_id,
|
||||
$url,
|
||||
$id,
|
||||
$title,
|
||||
$order,
|
||||
$parent,
|
||||
$decription,
|
||||
$collection_id;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Tainacan\Entities\Entity::repository
|
||||
|
@ -114,10 +130,19 @@ class Item extends Entity {
|
|||
/**
|
||||
* @return int|string
|
||||
*/
|
||||
/*function get_featured_img_id() {
|
||||
$featured_img_id = $this->get_featured_img_id();
|
||||
if ( isset( $featured_img_id ) ) {
|
||||
return $featured_img_id;
|
||||
}
|
||||
|
||||
return get_post_thumbnail_id( $this->get_id() );
|
||||
}*/
|
||||
function get_featured_img_id() {
|
||||
if ( isset( $this->featured_img_id ) ) {
|
||||
return $this->featured_img_id;
|
||||
}
|
||||
$featured_img_id = $this->get_mapped_property("featured_img_id");
|
||||
if ( isset( $featured_img_id ) ) {
|
||||
return $featured_img_id;
|
||||
}
|
||||
|
||||
return get_post_thumbnail_id( $this->get_id() );
|
||||
}
|
||||
|
|
|
@ -8,6 +8,15 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
* Represents entity Log
|
||||
*/
|
||||
class Log extends Entity {
|
||||
|
||||
protected
|
||||
$title,
|
||||
$order,
|
||||
$parent,
|
||||
$decription,
|
||||
$blog_id,
|
||||
$user_id;
|
||||
|
||||
protected static $post_type = 'tainacan-log';
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
|
@ -9,7 +9,13 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
*/
|
||||
class Taxonomy extends Entity {
|
||||
use \Tainacan\Traits\Entity_Collections_Relation;
|
||||
|
||||
|
||||
protected
|
||||
$name,
|
||||
$description,
|
||||
$allow_insert,
|
||||
$slug;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Tainacan\Entities\Entity::post_type
|
||||
|
|
|
@ -8,6 +8,15 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
* Represents the Entity Term
|
||||
*/
|
||||
class Term extends Entity {
|
||||
protected
|
||||
$term_id,
|
||||
$name,
|
||||
$parent,
|
||||
$description,
|
||||
$user,
|
||||
$taxonomy;
|
||||
|
||||
|
||||
protected static $post_type = false;
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
Loading…
Reference in New Issue