LLMS_Post_Model::scrub( string $key, mixed $val )

Scrub field according to it’s type


Description Description

This is automatically called by set() method before anything is actually set.


Top ↑

Parameters Parameters

$key

(string) (Required) Property key.

$val

(mixed) (Required) Property value.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/abstracts/abstract.llms.post.model.php

	protected function scrub( $key, $val ) {
		/**
		 * Filters the property type being scrubbed.
		 *
		 * The dynamic portion of this hook, `$this->model_post_type`, refers to the model's post type. For example "course",
		 * "lesson", "membership", etc...
		 *
		 * @since Unknown
		 *
		 * @param string          $type      The property type.
		 * @param LLMS_Post_Model $llms_post The LLMS_Post_Model instance.
		 */
		$type = apply_filters( "llms_get_{$this->model_post_type}_property_type", $this->get_property_type( $key ), $this );

		/**
		 * Filters the scrubbed property.
		 *
		 * The first dynamic portion of this hook, `$this->model_post_type`, refers to the model's post type. For example "course",
		 * "lesson", "membership", etc...
		 * The second dynamic part of this hook, `$key`, refers to the property name.
		 *
		 * @since Unknown
		 *
		 * @param mixed           $scrubbed  The scrubbed property value.
		 * @param LLMS_Post_Model $llms_post The LLMS_Post_Model instance.
		 * @param string          $key       The property name.
		 * @param mixed           $val       The original property value.
		 */
		return apply_filters( "llms_scrub_{$this->model_post_type}_field_{$key}", $this->scrub_field( $val, $type ), $this, $key, $val );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.16.0 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.