@param        $object_type
@param null   $_null
@param int    $object_id
@param string $meta_key
@param string $meta_value
@param string $prev_value

@return bool|int|null
962690
public function update_meta( $object_type, $_null = null, $object_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {

		if ( pods_tableless() ) {
			return $_null;
		}

		$object = $this->get_object( $object_type, $object_id );

		if ( empty( $object_id ) || empty( $object ) || ! isset( $object['fields'][ $meta_key ] ) ) {
			return $_null;
		}

		if ( ! is_object( self::$current_field_pod ) || self::$current_field_pod->pod != $object['name'] ) {
			self::$current_field_pod = pods( $object['name'] );
		}

		$pod = self::$current_field_pod;

		if ( ( isset( $pod->fields[ $meta_key ] ) || false !== strpos( $meta_key, '.' ) ) && $pod->row !== null ) {

			$key = $meta_key;
			if ( false !== strpos( $meta_key, '.' ) ) {
				$key = current( explode( '.', $meta_key ) );
			}

			$pod->row[ $meta_key ] = $meta_value;

			if ( isset( $pod->fields[ $key ] ) ) {
				if ( in_array( $pod->fields[ $key ]['type'], PodsForm::tableless_field_types() ) && isset( $meta_cache[ '_pods_' . $key ] ) ) {
					unset( $meta_cache[ '_pods_' . $key ] );
				}
			}

		}

		$pod->save( $meta_key, $meta_value, $object_id, array( 'podsmeta_direct' => true, 'error_mode' => 'false' ) );

		return $object_id;
	}
506800
public function findObjectPics($object_type, $object_id)
    {
        $query = $this->db()->createQueryBuilder();
        return $query->select('*')
            ->from($this->table, 'p')
            ->where('p.object_type = ?')
            ->andWhere(('p.object_id = ?'))
            ->setParameter(0, $object_type)
            ->setParameter(1, $object_id)
            ->execute();
    }
1079622
public function seePostMetaFor( $post_id, $meta_key, $meta_value = null ) {
		$metas = get_post_meta( $post_id, $meta_key );

		$message = sprintf( 'Post meta %s does not exist', $meta_key );
		$this->assertNotEmpty( $metas, $message );

		if ( func_num_args() > 2 ) {
			$message = sprintf( 'Post meta %s does not contain expected value', $meta_key );
			$this->assertContains( $meta_value, $metas, $message );
		}
	}
806276
function is_protected_meta( $protected, $meta_key, $meta_type ) {
		
		// globals
		global $post;
		
		
		// if acf_get_field_reference returns a valid key, this is an acf value, so protect it!
		if( !$protected ) {
			
			$reference = get_field_reference( $meta_key, $post->ID );
			
			if( substr($reference, 0, 6) === 'field_' ) {
				
				$protected = true;
				
			} 
			
		}
		
		
		// return
		return $protected;
				
	}
483318
public function meta_boxes( $object_type, $object ) {

		if ( ! is_a( $object, 'WP_Post' ) ) {
			return;
		}

		$post_type = $object_type;
		$post      = $object;
		$taxos     = get_post_taxonomies( $post );

		if ( in_array( $this->taxo->taxonomy, $taxos, true ) ) {

			$tax = get_taxonomy( $this->taxo->taxonomy );

			# Remove default meta box:
			if ( $this->taxo->args['hierarchical'] ) {
				remove_meta_box( "{$this->taxo->taxonomy}div", $post_type, 'side' );
			} else {
				remove_meta_box( "tagsdiv-{$this->taxo->taxonomy}", $post_type, 'side' );
			}

			if ( ! current_user_can( $tax->cap->assign_terms ) ) {
				return;
			}

			if ( $this->args['meta_box'] ) {

				# Set the 'meta_box' argument to the actual meta box callback function name:
				if ( 'simple' === $this->args['meta_box'] ) {
					if ( $this->taxo->args['exclusive'] ) {
						$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
					} else {
						$this->args['meta_box'] = [ $this, 'meta_box_simple' ];
					}
				} elseif ( 'radio' === $this->args['meta_box'] ) {
					$this->taxo->args['exclusive'] = true;
					$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
				} elseif ( 'dropdown' === $this->args['meta_box'] ) {
					$this->taxo->args['exclusive'] = true;
					$this->args['meta_box'] = [ $this, 'meta_box_dropdown' ];
				}

				# Add the meta box, using the plural or singular taxonomy label where relevant:
				if ( $this->taxo->args['exclusive'] ) {
					add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, $this->args['meta_box'], $post_type, 'side' );
				} else {
					add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->name, $this->args['meta_box'], $post_type, 'side' );
				}
			} elseif ( false !== $this->args['meta_box'] ) {

				# This must be an 'exclusive' taxonomy. Add the radio meta box:
				add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, [ $this, 'meta_box_radio' ], $post_type, 'side' );

			}
		}

	}
687132
public static function post($key = null, $type = 'string', $defaultValue = '')
    {
        if (!$key) {
            return $_POST;
        }
        return self::typeConvert(isset($_POST[$key]) ? $_POST[$key] : $defaultValue, $type);
    }
895140
private static function adjustObjectLikeType(
        array $key_parts,
        array &$existing_types,
        array &$changed_var_ids,
        Type\Union $result_type,
        bool $has_not_isset
    ) {
        array_pop($key_parts);
        $array_key = array_pop($key_parts);
        array_pop($key_parts);

        if ($array_key === null) {
            throw new \UnexpectedValueException('Not expecting null array key');
        }

        if ($array_key[0] === '$') {
            return;
        }

        $array_key_offset = $array_key[0] === '\'' ? substr($array_key, 1, -1) : $array_key;

        $base_key = implode($key_parts);

        if (isset($existing_types[$base_key]) && $array_key_offset !== false) {
            $base_atomic_types = $existing_types[$base_key]->getTypes();

            if (isset($base_atomic_types['array'])
                && ($base_atomic_types['array'] instanceof Type\Atomic\ObjectLike
                    || ($base_atomic_types['array'] instanceof Type\Atomic\TArray
                        && $base_atomic_types['array']->type_params[0]->isArrayKey()
                        && $base_atomic_types['array']->type_params[1]->isMixed())
                        && !$has_not_isset)
            ) {
                if ($base_atomic_types['array'] instanceof Type\Atomic\TArray) {
                    $new_objectlike = new Type\Atomic\ObjectLike(
                        [
                            $array_key_offset => clone $result_type
                        ],
                        null
                    );

                    $new_objectlike->had_mixed_value = true;

                    $existing_types[$base_key]->addType($new_objectlike);
                } else {
                    $base_atomic_types['array']->properties[$array_key_offset] = clone $result_type;
                }

                $changed_var_ids[] = $base_key . '[' . $array_key . ']';

                if ($key_parts[count($key_parts) - 1] === ']') {
                    self::adjustObjectLikeType(
                        $key_parts,
                        $existing_types,
                        $changed_var_ids,
                        $existing_types[$base_key],
                        $has_not_isset
                    );
                }

                $existing_types[$base_key]->bustCache();
            }
        }
    }
89745
public function update($object, $meta=null)
    {
        $query = new Query\Update();
        if (!is_object($object)) {
            throw new \BadMethodCallException("Please use updateTable()");
        } 

        if ($meta) {
            $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
        } else {
            $meta = $this->mapper->getMeta(get_class($object));
        }

        if (!$meta->primary) {
            throw new Exception("Cannot update: meta {$meta->id} has no primary key");
        }
        if (!$meta->canUpdate) {
            throw new Exception("Meta {$meta->id} prohibits update");
        }

        event_before: {
            if (isset($meta->on['beforeUpdate'])) {
                foreach ($meta->on['beforeUpdate'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['beforeUpdate'])) {
                foreach ($this->on['beforeUpdate'] as $cb) { $cb($object, $meta); }
            }
        }

        query: {
            $query->set = $this->mapper->mapObjectToRow($object, $meta, 'update');
            $query->where = $meta->getIndexValue($object);

            list ($sql, $params, $props) = $query->buildQuery($meta);
            // don't need to do formatParams - it's already covered by the mapPropertiesToRow call in
            // table update mode

            $return = $this->getConnector()->exec($sql, $params);
        }

        event_after: {
            if (isset($meta->on['afterUpdate'])) {
                foreach ($meta->on['afterUpdate'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['afterUpdate'])) {
                foreach ($this->on['afterUpdate'] as $cb) { $cb($object, $meta); }
            }
        }
        return $return;
    }
787543
public function prev_id( $id = null, $params_override = null ) {

		if ( null === $id ) {
			$id = $this->id();
		}

		$id = (int) $id;

		$params = array(
			'select'  => "`t`.`{$this->data->field_id}`",
			'where'   => "`t`.`{$this->data->field_id}` < {$id}",
			'orderby' => "`t`.`{$this->data->field_id}` DESC",
			'limit'   => 1,
		);

		if ( ! empty( $params_override ) || ! empty( $this->params ) ) {
			if ( ! empty( $params_override ) ) {
				$params = $params_override;
			} elseif ( ! empty( $this->params ) ) {
				$params = $this->params;
			}

			if ( is_object( $params ) ) {
				$params = get_object_vars( $params );
			}

			if ( 0 < $id ) {
				if ( isset( $params['where'] ) && ! empty( $params['where'] ) ) {
					$params['where']   = (array) $params['where'];
					$params['where'][] = "`t`.`{$this->data->field_id}` < {$id}";
				} else {
					$params['where'] = "`t`.`{$this->data->field_id}` < {$id}";
				}
			} elseif ( isset( $params['offset'] ) && 0 < $params['offset'] ) {
				$params['offset'] --;
			} elseif ( 0 < $this->row_number && ! isset( $params['offset'] ) && ! empty( $this->params ) ) {
				$params['offset'] = $this->row_number - 1;
			} else {
				return 0;
			}

			if ( isset( $params['orderby'] ) && ! empty( $params['orderby'] ) ) {
				if ( is_array( $params['orderby'] ) ) {
					foreach ( $params['orderby'] as $orderby => $dir ) {
						$dir = strtoupper( $dir );

						if ( ! in_array( $dir, array( 'ASC', 'DESC' ), true ) ) {
							continue;
						}

						if ( 'ASC' === $dir ) {
							$params['orderby'][ $orderby ] = 'DESC';
						} else {
							$params['orderby'][ $orderby ] = 'ASC';
						}
					}

					$params['orderby'][ $this->data->field_id ] = 'DESC';
				} elseif ( "`t`.`{$this->data->field_id}` DESC" !== $params['orderby'] ) {
					$params['orderby'] .= ", `t`.`{$this->data->field_id}` DESC";
				}
			}//end if

			$params['select'] = "`t`.`{$this->data->field_id}`";
			$params['limit']  = 1;
		}//end if

		$pod = pods( $this->pod, $params );

		$new_id = 0;

		if ( $pod->fetch() ) {
			$new_id = $pod->id();
		}

		$new_id = $this->do_hook( 'prev_id', $new_id, $id, $pod, $params_override );

		return $new_id;
	}
485841
protected function check_object_id( $object_id ) {
		$fetcher = new SiteFetcher();
		$site    = $fetcher->get_check( $object_id );
		return $site->blog_id;
	}
162781
public function add_meta( $meta_key, $meta_value ) {
		return add_metadata( $this->meta_type, $this->get_id(), $meta_key, $meta_value, true );
	}
399447
final public function saveObject($objectURI = NULL, $objectType = NULL, $objectId = NULL, $forceNew = false )
    {

        $isNew = (empty($objectId) && empty($objectURI)) ? true : (($forceNew)? true : false );

        //if we are forcing a new object;

        //Get a randomstring for the objectURI
        $objectURI = empty($objectURI) ? getRandomString(10, false, true) : $objectURI;
        $objectType = empty($objectType) ? 'entity' : $objectType;
        //$objectId = empty($objectId) ?  (!empty($this->objectId) ? $this->objectId : null ) : $objectId;
        //Ensure we have all the properties
        if (empty($this->propertyModel) || empty($this->propertyData))
            return false; //We have nothing to save

        //Use a transaction;
        $this->database->startTransaction();
        $pquery = "INSERT IGNORE INTO ?properties (property_name, property_label, property_datatype, property_charsize, property_default, property_indexed) VALUES\n";
        $pqueryV = array();
        foreach ($this->propertyModel as $property => $definition) {
            $values = array($this->database->quote($property), $this->database->quote($definition[0]), $this->database->quote($definition[1])); //Name, Label, DataType
            $values[] = (isset($definition[2])) ? $this->database->quote($definition[2]) : $this->database->quote(""); //Charsize
            $values[] = (isset($definition[3])) ? $this->database->quote($definition[3]) : $this->database->quote(""); //Default
            $values[] = (isset($definition[4]) && $definition[4]) ? $this->database->quote(1) : $this->database->quote(0); //Indexed

            $pqueryV[] = " (" . implode(', ', $values) . " )";
        }
        $pquery .= implode(', ', $pqueryV);


        //update the properties
        $this->database->query($pquery);

        //If objectId is NULL then NEW Create new object
        if ($isNew):

            //Log::message("Object ID is {$objectId}");

            $timestamp = Time::stamp();

            $oquery = $this->database->insert("?objects", array("object_uri" => $this->database->quote($objectURI), "object_type" => $this->database->quote($objectType), "object_created_on" => $this->database->quote($timestamp)), FALSE, NULL, FALSE);
            $this->database->query($oquery);

            $this->setLastSavedObjectURI($objectURI);
        endif;



        //If property exists and value doesnt insert new value row
        //If property exists and value exists update value
        //if property does not exists, insert property and insert value
        $vtable = "?{$this->valueGroup}property_values";

        $iquery = "REPLACE INTO {$vtable} (property_id, object_id, value_data)";
        $iqueryV = array();
        foreach ($this->propertyData as $propertyName => $valueData):
            //@TODO validate the data?
            if (empty($valueData))
                continue; //There is no point in storing empty values;


//@TODO also check that value data has data for fields demarkated as allowempty=false;
            $iqueryV[] = "\nSELECT p.property_id, o.object_id, {$this->database->quote($valueData)}  FROM `?properties` AS p JOIN `?objects` AS o WHERE o.object_uri={$this->database->quote($objectURI)} AND p.property_name={$this->database->quote($propertyName)}";
        endforeach;
        $iquery .= implode("\nUNION ALL", $iqueryV);

        $this->database->query($iquery);
        //Update the object URI so the last update field is auto updated
        //$this->database->exec( "UPDATE ?objects SET objected_updated_on=CURRENT_TIMESTAMP" WHERE object_uri=" );

        if (!$this->database->commitTransaction()) {
            throw new Exception("Could not commit transaction");
            return false;
        }

        return true;
    }
298506
public function whereMeta($meta, $operator = null, $value = null)
	{
		if (null === $value) {
			$value = $operator;
			$operator = '=';
		}
		
		$metas = is_array($meta) ? $meta : array($meta => array($value, $operator));
		
		foreach ($metas as $m => $d) {
			$v = is_array($d) ? Arr::get($d, 0) : $d;
			$o = is_array($d) ? Arr::get($d, 1, '=') : '=';
			
			if (is_object($m)) {
				$this->filters[]['metas'][] = array('id' => $m->id, 'value' => $v, 'operator' => $o);
			}
			else {
				$this->filters[]['metas'][] = array('name' => $m, 'value' => $v, 'operator' => $o);
			}
		}
		
		return $this;
	}
1118387
function __debugMeta( object, type, meta ) {
	// Dont' re-define meta
	if ((object !== undefined) && (object.__meta === undefined)) {
		if (typeof object === 'object')
			Object.defineProperty(
				object, "__meta", {
					enumerable: false,
					value: {
						'type': type,
						'meta': meta,
					},
				}
			);
	}

	// Return object for return calls
	return object;
}
918992
function objectInfo($object_array) {
//this line should be added, but should be tested first:
//      if (!is_array($object_array)) return;
      reset($object_array);
      while (list($key, $value) = each($object_array)) {
        $this->$key = zen_db_prepare_input($value);
      }
    }
772989
public function delete( $key, $user_id = null, $meta_value = '' ) {
		if ( ! isset( $user_id ) ) {
			$user_id = $this->user_id;
		}
		if ( $user_id <= 0 ) {
			return false;
		}

		return delete_user_meta( $user_id, $this->get_meta_key( $key ), $meta_value );
	}
534571
public function objectIdChanged(string $objectType, string $oldObjectId, string $newObjectId)
    {
        //==============================================================================
        // Create Event Object
        $event = new ObjectsIdChangedEvent($this->getWebserviceId(), $objectType, $oldObjectId, $newObjectId);
        //==============================================================================
        //      Dispatch Event
        $this->getEventDispatcher()->dispatch(ObjectsIdChangedEvent::NAME, $event);

        return true;
    }