Checks user meta exists for an user.

@since 1.0.0

@access public
@param int $user_id The user id.
@param string $meta_key The meta key to check.
@param mixed $meta_value The meta value to check
163061
public function seeUserMetaFor( $user_id, $meta_key, $meta_value = null ) {
		$metas = get_user_meta( $user_id, $meta_key );

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

		if ( func_num_args() > 2 ) {
			$message = sprintf( 'User meta %s does not contain expected value', $meta_key );
			$this->assertContains( $meta_value, $metas, $message );
		}
	}
566292
function delete_meta($meta_key) {
		return $this->edit_meta( $meta_key, function($id, $key, $path) {
			if ( $path ) {
				# Patch -- XXX unserialize and count up?
				$old = static::_get_meta($id, $key);
				if ( $old === false ) $old = array();
				$traverser = new RecursiveDataStructureTraverser($old);
				while ( $path ) {
					# nothing to delete?
					if ( ! $traverser->exists($path[0]) ) return;
					$traverser = $traverser->traverse_to(array($path[0]));
					array_shift($path);
				}
				$traverser->unset_on_parent();
				static::_set_meta($id, $key, $old);  # XXX reserialize and count down?
			} else {
				static::_delete_meta($id, $key);
			}
		});
	}
992965
protected function initMeta(): void
    {
        // cache for reflection data
        $cacheKey = "meta.{$this->module}.{$this->controller}";

        if (!$meta = Cache::get($cacheKey)) {
            $meta = new Meta($this->getFile());
            $meta->process();

            Cache::set(
                $cacheKey,
                $meta,
                Cache::TTL_NO_EXPIRY,
                ['system', 'meta']
            );
        }
        $this->meta = $meta;
    }
83217
public function col_post_meta( string $meta_key, array $args ) {

		$vals = get_post_meta( get_the_ID(), $meta_key, false );
		$echo = [];
		sort( $vals );

		if ( isset( $args['date_format'] ) ) {

			if ( true === $args['date_format'] ) {
				$args['date_format'] = get_option( 'date_format' );
			}

			foreach ( $vals as $val ) {
				$val_time = strtotime( $val );

				if ( $val_time ) {
					$val = $val_time;
				}

				if ( is_numeric( $val ) ) {
					$echo[] = date_i18n( $args['date_format'], $val );
				} elseif ( ! empty( $val ) ) {
					$echo[] = mysql2date( $args['date_format'], $val );
				}
			}
		} else {

			foreach ( $vals as $val ) {

				if ( ! empty( $val ) || ( '0' === $val ) ) {
					$echo[] = $val;
				}
			}
		}

		if ( empty( $echo ) ) {
			echo '&#8212;';
		} else {
			echo esc_html( implode( ', ', $echo ) );
		}

	}
858613
public function save_meta( $_null, $post_ID = null, $meta_key = null, $meta_value = null ) {

		if ( 'code' === $meta_key ) {
			$post = get_post( $post_ID );

			if ( is_object( $post ) && $this->object_type == $post->post_type ) {
				$postdata = array(
					'ID'           => $post_ID,
					'post_content' => $meta_value,
				);

				remove_filter( current_filter(), array( $this, __FUNCTION__ ) );

				$revisions = false;

				if ( has_action( 'pre_post_update', 'wp_save_post_revision' ) ) {
					remove_action( 'pre_post_update', 'wp_save_post_revision' );

					$revisions = true;
				}

				wp_update_post( (object) $postdata );
				// objects will be automatically sanitized
				if ( $revisions ) {
					add_action( 'pre_post_update', 'wp_save_post_revision' );
				}

				return true;
			}//end if
		}//end if

		return $_null;
	}
790453
public function addMeta($key, $value)
    {
        $existing = $this->meta()
            ->where('key', $key)
            ->where('value', Helpers::maybeEncode($value))
            ->first();

        if ($existing) {
            return false;
        }

        $meta = $this->meta()->create([
            'key'   => $key,
            'value' => $value,
        ]);

        return $meta->isSaved() ? $meta : $meta->getErrors();
    }
197388
public function addLink($key, $href, array $meta=[]) {
		$this->ensureLinksObject();
		$this->links->add($key, $href, $meta);
	}
429826
protected function _meta()
  {
    if (!isset($this->_meta)) {
      $this->_meta = new UserMeta($this->id);
    }
    return $this->_meta;
  }
145905
public function meta($key = null, $value = null)
    {
        if (is_null($key)) {
            return $this->getMeta();
        }

        if (is_null($value)) {
            return $this->getMeta($key);
        }

        return $this->setMeta($key, $value);
    }
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;
	}
834391
private static function checkValidate(Meta $m)
    {
        if (!empty($m->getAllow()['validate'])) {
            if ($m->getAllow()['validate'] === "email" && !Check::email($m->getValue()))
                $m->setError("email inválido.");

            elseif ($m->getAllow()['validate'] === "cpf" && !Check::cpf($m->getValue()))
                $m->setError("CPF inválido.");

            elseif ($m->getAllow()['validate'] === "cnpj" && !Check::cnpj($m->getValue()))
                $m->setError("CNPJ inválido.");
        }
    }
24439
public function deleteConsumer ( $consumer_key, $user_id, $user_is_admin = false )
    {
        if ($user_is_admin)
        {
            $this->query('
                    DELETE FROM oauth_server_registry
                    WHERE osr_consumer_key = \'%s\'
                      AND (osr_usa_id_ref = \'%d\' OR osr_usa_id_ref IS NULL)
                    ', $consumer_key, $user_id);
        }
        else
        {
            $this->query('
                    DELETE FROM oauth_server_registry
                    WHERE osr_consumer_key = \'%s\'
                      AND osr_usa_id_ref   = \'%d\'
                    ', $consumer_key, $user_id);
        }
    }
966468
public function getConsumer ( $consumer_key, $user_id, $user_is_admin = false )
    {
        $consumer = $this->query_row_assoc('
                        SELECT    *
                        FROM oauth_server_registry
                        WHERE osr_consumer_key = \'%s\'
                        ', $consumer_key);

        if (!is_array($consumer))
        {
            throw new OAuthException2('No consumer with consumer_key "'.$consumer_key.'"');
        }

        $c = array();
        foreach ($consumer as $key => $value)
        {
            $c[substr($key, 4)] = $value;
        }
        $c['user_id'] = $c['usa_id_ref'];

        if (!$user_is_admin && !empty($c['user_id']) && $c['user_id'] != $user_id)
        {
            throw new OAuthException2('No access to the consumer information for consumer_key "'.$consumer_key.'"');
        }
        return $c;
    }
736395
public static function find_trusted_emails($user_id)
	{
		if (empty($user_id) || !is_numeric($user_id))
		{
			return false;
		}

		$results = self::all()
			->whereEquals('user_id', $user_id)
			->rows()
			->fieldsByKey('email');

		if (empty($results))
		{
			return false;
		}

		return $results;
	}
141374
public function setMeta($key, $value)
    {
        $meta = $this->meta;
        $meta[$key] = $value;
        $this->meta = $meta;

        return $this->save();
    }
957310
public function getConsumer ( $consumer_key, $user_id, $user_is_admin = false ) {
           
            $sql = "BEGIN SP_GET_CONSUMER(:P_CONSUMER_KEY, :P_ROWS, :P_RESULT); END;";

            // parse sql
            $stmt = oci_parse($this->conn, $sql) or die ('Can not parse query');

            // Bind In and Out Variables
            oci_bind_by_name($stmt, ':P_CONSUMER_KEY', $consumer_key, 255);
            oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

            //Bind the ref cursor
            $p_row = oci_new_cursor($this->conn);
            oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);

            //Execute the statement
            oci_execute($stmt);

            // treat the ref cursor as a statement resource
            oci_execute($p_row, OCI_DEFAULT);
            oci_fetch_all($p_row, $getConsumerList, null, null, OCI_FETCHSTATEMENT_BY_ROW);

            $consumer = $getConsumerList;
           
		    if (!is_array($consumer)) {
                throw new OAuthException2('No consumer with consumer_key "'.$consumer_key.'"');
            }

            $c = array();
            foreach ($consumer as $key => $value) {
                $c[substr($key, 4)] = $value;
            }
            $c['user_id'] = $c['usa_id_ref'];

            if (!$user_is_admin && !empty($c['user_id']) && $c['user_id'] != $user_id) {
                throw new OAuthException2('No access to the consumer information for consumer_key "'.$consumer_key.'"');
            }
            return $c;
        }
251667
public function meta(string $name, $value = null)
    {
        if ($value === null) {
            return $this->getMeta($name);
        }

        $this->setMeta($name, $value);
    }