public function __construct($pod = null, $id = 0, $strict = true)
{
global $wpdb;
if (is_object($pod) && 'PodsAPI' == get_class($pod)) {
$this->api = $pod;
$pod = $this->api->pod;
} else {
$this->api = pods_api($pod);
}
$this->api->display_errors =& self::$display_errors;
if (!empty($pod)) {
$this->pod_data =& $this->api->pod_data;
if (false === $this->pod_data) {
if (true === $strict) {
return pods_error('Pod not found', $this);
} else {
return $this;
}
}
$this->pod_id = $this->pod_data['id'];
$this->pod = $this->pod_data['name'];
$this->fields = $this->pod_data['fields'];
if (isset($this->pod_data['options']['detail_url'])) {
$this->detail_page = $this->pod_data['options']['detail_url'];
}
if (isset($this->pod_data['select'])) {
$this->select = $this->pod_data['select'];
}
if (isset($this->pod_data['table'])) {
$this->table = $this->pod_data['table'];
}
if (isset($this->pod_data['join'])) {
$this->join = $this->pod_data['join'];
}
if (isset($this->pod_data['field_id'])) {
$this->field_id = $this->pod_data['field_id'];
}
if (isset($this->pod_data['field_index'])) {
$this->field_index = $this->pod_data['field_index'];
}
if (isset($this->pod_data['field_slug'])) {
$this->field_slug = $this->pod_data['field_slug'];
}
if (isset($this->pod_data['where'])) {
$this->where = $this->pod_data['where'];
}
if (isset($this->pod_data['where_default'])) {
$this->where_default = $this->pod_data['where_default'];
}
if (isset($this->pod_data['orderby'])) {
$this->orderby = $this->pod_data['orderby'];
}
if ('settings' == $this->pod_data['type']) {
$this->id = $this->pod_data['id'];
$this->fetch($this->id);
} elseif (null !== $id && !is_array($id) && !is_object($id)) {
$this->id = $id;
$this->fetch($this->id);
}
}
}