1 <?php
2
3 4 5 6 7 8 9 10 11
12 namespace uix\data;
13
14 abstract class data extends \uix\ui\uix{
15
16 17 18 19 20 21 22
23 protected $data = array();
24
25 26 27 28 29 30 31
32 public function setup() {
33 if( !empty( $this->struct['sanitize_callback'] ) )
34 add_filter( 'uix_' . $this->slug . '_sanitize_' . $this->type, $this->struct['sanitize_callback'] );
35
36 parent::setup();
37 }
38
39 40 41 42 43 44
45 public function set_data( $data ){
46
47 if( isset( $data[ $this->slug ] ) )
48 $this->data[$this->id()][$this->slug] = apply_filters('uix_' . $this->slug . '_sanitize_' . $this->type, $data[$this->slug], $this);
49
50 }
51
52 53 54 55 56 57
58 public function get_data(){
59 $data = null;
60 if( isset( $this->data[ $this->id() ] ) )
61 $data = $this->data[ $this->id() ];
62
63 return $data;
64 }
65
66
67 }
68