PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/interfaces/interface-curd.php +234 -234 4.3.94.4.8 View file →
@@ -1,234 +1,234 @@
1 -<?php
2 -
3 -/**
4 - * Interface LP_Interface_CURD
5 - */
6 -interface LP_Interface_CURD {
7 -
8 - /**
9 - * Create item and insert to database.
10 - *
11 - * @since 3.0.0
12 - *
13 - * @param object $object
14 - */
15 - public function create( &$object );
16 -
17 - /**
18 - * Load data from database.
19 - *
20 - * @since 3.0.0
21 - *
22 - * @param object $object
23 - */
24 - public function load( &$object );
25 -
26 - /**
27 - * Update data into database.
28 - *
29 - * @since 3.0.0
30 - *
31 - * @param object $object
32 - */
33 - public function update( &$object );
34 -
35 - /**
36 - * Delete data from database.
37 - *
38 - * @since 3.0.0
39 - *
40 - * @param object $object
41 - */
42 - public function delete( &$object );
43 -
44 - /**
45 - * Duplicate item and insert to database
46 - *
47 - * @param $object
48 - * @param array $args
49 - *
50 - * @return mixed
51 - */
52 - public function duplicate( &$object, $args = array() );
53 -
54 - /**
55 - * Add new meta data.
56 - *
57 - * @since 3.0.0
58 - *
59 - * @param $object
60 - * @param $meta
61 - */
62 - public function add_meta( &$object, $meta );
63 -
64 - /**
65 - * Read meta data for passed object.
66 - *
67 - * @since 3.0.0
68 - *
69 - * @param $object
70 - */
71 - public function read_meta( &$object );
72 -
73 - /**
74 - * Update meta data.
75 - *
76 - * @since 3.0.0
77 - *
78 - * @param $object
79 - * @param $meta
80 - */
81 - public function update_meta( &$object, $meta );
82 -
83 - /**
84 - * Delete meta data.
85 - *
86 - * @since 3.0.0
87 - *
88 - * @param $object
89 - * @param $meta
90 - */
91 - public function delete_meta( &$object, $meta );
92 -
93 -}
94 -
95 -/**
96 - * Class LP_Object_Data_Meta
97 - */
98 -class LP_Object_Data_CURD {
99 -
100 - /**
101 - * @var string
102 - */
103 - protected $_meta_type = 'post';
104 -
105 - /**
106 - * Errors codes and message.
107 - *
108 - * @var bool
109 - */
110 - protected $_error_messages = false;
111 -
112 - /**
113 - * Add new meta data.
114 - *
115 - * @param $object
116 - * @param $meta
117 - */
118 - public function add_meta( &$object, $meta ) {
119 - // TODO: Implement add_meta() method.
120 - }
121 -
122 - /**
123 - * Delete meta data.
124 - *
125 - * @since 3.0.0
126 - *
127 - * @param $object
128 - * @param $meta
129 - */
130 - public function delete_meta( &$object, $meta ) {
131 - // TODO: Implement delete_meta() method.
132 - }
133 -
134 - /**
135 - * @param $object
136 - */
137 - public function read_meta( &$object ) {
138 - }
139 -
140 - /**
141 - * @editor tungnx
142 - * @modify 4.1.4 - comment - not use
143 - */
144 - /*public function read_meta_by_ids( $ids, $type = 'post' ) {
145 - $this->_meta_type = $type;
146 - foreach ( $ids as $id ) {
147 - $this->read_meta( $id );
148 - }
149 - }*/
150 -
151 - /**
152 - * @editor tungnx
153 - * @modify 4.1.4 - comment - not use
154 - */
155 - /*public function _filter_meta_by_object( $v, $k ) {
156 - return $v->{$this->_filter_object_name} == $this->_filter_object;
157 - }*/
158 -
159 - /**
160 - * Update meta data.
161 - *
162 - * @since 3.0.0
163 - *
164 - * @param $object LP_Course|LP_Lesson|LP_Quiz|LP_Question
165 - * @param $meta
166 - */
167 - public function update_meta( &$object, $meta ) {
168 - update_metadata( $this->_meta_type, $object->get_id(), $meta->meta_key, $meta->meta_value );
169 - }
170 -
171 - /**
172 - * @param $type
173 - *
174 - * @return mixed|LP_Object_Data_CURD
175 - */
176 - public static function get( $type ) {
177 - static $curds = false;
178 - if ( ! $curds ) {
179 - $curds = array(
180 - 'user' => new LP_User_CURD(),
181 - 'order' => new LP_Order_CURD(),
182 - );
183 - }
184 -
185 - return ! empty( $curds[ $type ] ) ? $curds[ $type ] : false;
186 - }
187 -
188 - /**
189 - * Get WP_Object.
190 - *
191 - * @param $code
192 - *
193 - * @return bool|WP_Error
194 - */
195 - protected function get_error( $code ) {
196 - if ( isset( $this->_error_messages[ $code ] ) ) {
197 - return new WP_Error( $code, $this->_error_messages[ $code ] );
198 - }
199 -
200 - return false;
201 - }
202 -
203 - /**
204 - * Wrap function $wpdb->prepare(...) to support arguments as
205 - * array.
206 - *
207 - * @param string $query
208 - * @param array|mixed $args
209 - *
210 - * @example
211 - *
212 - * $this->prepare($sql, $one, $two, array($three, $four, $file))
213 - * => $wpdb->prepare($sql, $one, $two, $three, $four, $file)
214 - *
215 - * @return string
216 - * @editor tungnx - comment method
217 - */
218 - /*public function prepare( $query, $args ) {
219 - global $wpdb;
220 - $args = func_get_args();
221 - array_shift( $args );
222 - $new_args = array();
223 -
224 - foreach ( $args as $arg ) {
225 - if ( is_array( $arg ) ) {
226 - $new_args = array_merge( $new_args, $arg );
227 - } else {
228 - $new_args[] = $arg;
229 - }
230 - }
231 -
232 - return $wpdb->prepare( $query, $new_args );
233 - }*/
234 -}
1 +<?php
2 +
3 +/**
4 + * Interface LP_Interface_CURD
5 + */
6 +interface LP_Interface_CURD {
7 +
8 + /**
9 + * Create item and insert to database.
10 + *
11 + * @since 3.0.0
12 + *
13 + * @param object $object
14 + */
15 + public function create( &$object );
16 +
17 + /**
18 + * Load data from database.
19 + *
20 + * @since 3.0.0
21 + *
22 + * @param object $object
23 + */
24 + public function load( &$object );
25 +
26 + /**
27 + * Update data into database.
28 + *
29 + * @since 3.0.0
30 + *
31 + * @param object $object
32 + */
33 + public function update( &$object );
34 +
35 + /**
36 + * Delete data from database.
37 + *
38 + * @since 3.0.0
39 + *
40 + * @param object $object
41 + */
42 + public function delete( &$object );
43 +
44 + /**
45 + * Duplicate item and insert to database
46 + *
47 + * @param $object
48 + * @param array $args
49 + *
50 + * @return mixed
51 + */
52 + public function duplicate( &$object, $args = array() );
53 +
54 + /**
55 + * Add new meta data.
56 + *
57 + * @since 3.0.0
58 + *
59 + * @param $object
60 + * @param $meta
61 + */
62 + public function add_meta( &$object, $meta );
63 +
64 + /**
65 + * Read meta data for passed object.
66 + *
67 + * @since 3.0.0
68 + *
69 + * @param $object
70 + */
71 + public function read_meta( &$object );
72 +
73 + /**
74 + * Update meta data.
75 + *
76 + * @since 3.0.0
77 + *
78 + * @param $object
79 + * @param $meta
80 + */
81 + public function update_meta( &$object, $meta );
82 +
83 + /**
84 + * Delete meta data.
85 + *
86 + * @since 3.0.0
87 + *
88 + * @param $object
89 + * @param $meta
90 + */
91 + public function delete_meta( &$object, $meta );
92 +
93 +}
94 +
95 +/**
96 + * Class LP_Object_Data_Meta
97 + */
98 +class LP_Object_Data_CURD {
99 +
100 + /**
101 + * @var string
102 + */
103 + protected $_meta_type = 'post';
104 +
105 + /**
106 + * Errors codes and message.
107 + *
108 + * @var bool
109 + */
110 + protected $_error_messages = false;
111 +
112 + /**
113 + * Add new meta data.
114 + *
115 + * @param $object
116 + * @param $meta
117 + */
118 + public function add_meta( &$object, $meta ) {
119 + // TODO: Implement add_meta() method.
120 + }
121 +
122 + /**
123 + * Delete meta data.
124 + *
125 + * @since 3.0.0
126 + *
127 + * @param $object
128 + * @param $meta
129 + */
130 + public function delete_meta( &$object, $meta ) {
131 + // TODO: Implement delete_meta() method.
132 + }
133 +
134 + /**
135 + * @param $object
136 + */
137 + public function read_meta( &$object ) {
138 + }
139 +
140 + /**
141 + * @editor tungnx
142 + * @modify 4.1.4 - comment - not use
143 + */
144 + /*public function read_meta_by_ids( $ids, $type = 'post' ) {
145 + $this->_meta_type = $type;
146 + foreach ( $ids as $id ) {
147 + $this->read_meta( $id );
148 + }
149 + }*/
150 +
151 + /**
152 + * @editor tungnx
153 + * @modify 4.1.4 - comment - not use
154 + */
155 + /*public function _filter_meta_by_object( $v, $k ) {
156 + return $v->{$this->_filter_object_name} == $this->_filter_object;
157 + }*/
158 +
159 + /**
160 + * Update meta data.
161 + *
162 + * @since 3.0.0
163 + *
164 + * @param $object LP_Course|LP_Lesson|LP_Quiz|LP_Question
165 + * @param $meta
166 + */
167 + public function update_meta( &$object, $meta ) {
168 + update_metadata( $this->_meta_type, $object->get_id(), $meta->meta_key, $meta->meta_value );
169 + }
170 +
171 + /**
172 + * @param $type
173 + *
174 + * @return mixed|LP_Object_Data_CURD
175 + */
176 + public static function get( $type ) {
177 + static $curds = false;
178 + if ( ! $curds ) {
179 + $curds = array(
180 + 'user' => new LP_User_CURD(),
181 + 'order' => new LP_Order_CURD(),
182 + );
183 + }
184 +
185 + return ! empty( $curds[ $type ] ) ? $curds[ $type ] : false;
186 + }
187 +
188 + /**
189 + * Get WP_Object.
190 + *
191 + * @param $code
192 + *
193 + * @return bool|WP_Error
194 + */
195 + protected function get_error( $code ) {
196 + if ( isset( $this->_error_messages[ $code ] ) ) {
197 + return new WP_Error( $code, $this->_error_messages[ $code ] );
198 + }
199 +
200 + return false;
201 + }
202 +
203 + /**
204 + * Wrap function $wpdb->prepare(...) to support arguments as
205 + * array.
206 + *
207 + * @param string $query
208 + * @param array|mixed $args
209 + *
210 + * @example
211 + *
212 + * $this->prepare($sql, $one, $two, array($three, $four, $file))
213 + * => $wpdb->prepare($sql, $one, $two, $three, $four, $file)
214 + *
215 + * @return string
216 + * @editor tungnx - comment method
217 + */
218 + /*public function prepare( $query, $args ) {
219 + global $wpdb;
220 + $args = func_get_args();
221 + array_shift( $args );
222 + $new_args = array();
223 +
224 + foreach ( $args as $arg ) {
225 + if ( is_array( $arg ) ) {
226 + $new_args = array_merge( $new_args, $arg );
227 + } else {
228 + $new_args[] = $arg;
229 + }
230 + }
231 +
232 + return $wpdb->prepare( $query, $new_args );
233 + }*/
234 +}