_meta_type = $type; foreach ( $ids as $id ) { $this->read_meta( $id ); } }*/ /** * @editor tungnx * @modify 4.1.4 - comment - not use */ /*public function _filter_meta_by_object( $v, $k ) { return $v->{$this->_filter_object_name} == $this->_filter_object; }*/ /** * Update meta data. * * @since 3.0.0 * * @param $object LP_Course|LP_Lesson|LP_Quiz|LP_Question * @param $meta */ public function update_meta( &$object, $meta ) { update_metadata( $this->_meta_type, $object->get_id(), $meta->meta_key, $meta->meta_value ); } /** * @param $type * * @return mixed|LP_Object_Data_CURD */ public static function get( $type ) { static $curds = false; if ( ! $curds ) { $curds = array( 'user' => new LP_User_CURD(), 'order' => new LP_Order_CURD(), ); } return ! empty( $curds[ $type ] ) ? $curds[ $type ] : false; } /** * Get WP_Object. * * @param $code * * @return bool|WP_Error */ protected function get_error( $code ) { if ( isset( $this->_error_messages[ $code ] ) ) { return new WP_Error( $code, $this->_error_messages[ $code ] ); } return false; } /** * Wrap function $wpdb->prepare(...) to support arguments as * array. * * @param string $query * @param array|mixed $args * * @example * * $this->prepare($sql, $one, $two, array($three, $four, $file)) * => $wpdb->prepare($sql, $one, $two, $three, $four, $file) * * @return string * @editor tungnx - comment method */ /*public function prepare( $query, $args ) { global $wpdb; $args = func_get_args(); array_shift( $args ); $new_args = array(); foreach ( $args as $arg ) { if ( is_array( $arg ) ) { $new_args = array_merge( $new_args, $arg ); } else { $new_args[] = $arg; } } return $wpdb->prepare( $query, $new_args ); }*/ }