equal
deleted
inserted
replaced
511 * Checks user capabilities and theme supports, and then saves |
511 * Checks user capabilities and theme supports, and then saves |
512 * the value of the setting. |
512 * the value of the setting. |
513 * |
513 * |
514 * @since 3.4.0 |
514 * @since 3.4.0 |
515 * |
515 * |
516 * @return void|false False if cap check fails or value isn't set or is invalid. |
516 * @return void|false Void on success, false if cap check fails |
|
517 * or value isn't set or is invalid. |
517 */ |
518 */ |
518 final public function save() { |
519 final public function save() { |
519 $value = $this->post_value(); |
520 $value = $this->post_value(); |
520 |
521 |
521 if ( ! $this->check_capabilities() || ! isset( $value ) ) { |
522 if ( ! $this->check_capabilities() || ! isset( $value ) ) { |
603 * |
604 * |
604 * @since 4.6.0 |
605 * @since 4.6.0 |
605 * |
606 * |
606 * @param WP_Error $validity Filtered from `true` to `WP_Error` when invalid. |
607 * @param WP_Error $validity Filtered from `true` to `WP_Error` when invalid. |
607 * @param mixed $value Value of the setting. |
608 * @param mixed $value Value of the setting. |
608 * @param WP_Customize_Setting $this WP_Customize_Setting instance. |
609 * @param WP_Customize_Setting $setting WP_Customize_Setting instance. |
609 */ |
610 */ |
610 $validity = apply_filters( "customize_validate_{$this->id}", $validity, $value, $this ); |
611 $validity = apply_filters( "customize_validate_{$this->id}", $validity, $value, $this ); |
611 |
612 |
612 if ( is_wp_error( $validity ) && ! $validity->has_errors() ) { |
613 if ( is_wp_error( $validity ) && ! $validity->has_errors() ) { |
613 $validity = true; |
614 $validity = true; |
759 * |
760 * |
760 * @since 3.4.0 |
761 * @since 3.4.0 |
761 * @since 4.6.0 Added the `$this` setting instance as the second parameter. |
762 * @since 4.6.0 Added the `$this` setting instance as the second parameter. |
762 * |
763 * |
763 * @param mixed $default The setting default value. Default empty. |
764 * @param mixed $default The setting default value. Default empty. |
764 * @param WP_Customize_Setting $this The setting instance. |
765 * @param WP_Customize_Setting $setting The setting instance. |
765 */ |
766 */ |
766 $value = apply_filters( "customize_value_{$id_base}", $value, $this ); |
767 $value = apply_filters( "customize_value_{$id_base}", $value, $this ); |
767 } elseif ( $this->is_multidimensional_aggregated ) { |
768 } elseif ( $this->is_multidimensional_aggregated ) { |
768 $root_value = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value']; |
769 $root_value = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value']; |
769 $value = $this->multidimensional_get( $root_value, $this->id_data['keys'], $this->default ); |
770 $value = $this->multidimensional_get( $root_value, $this->id_data['keys'], $this->default ); |
792 * |
793 * |
793 * The dynamic portion of the hook name, `$this->id`, refers to the setting ID. |
794 * The dynamic portion of the hook name, `$this->id`, refers to the setting ID. |
794 * |
795 * |
795 * @since 3.4.0 |
796 * @since 3.4.0 |
796 * |
797 * |
797 * @param mixed $value The setting value. |
798 * @param mixed $value The setting value. |
798 * @param WP_Customize_Setting $this WP_Customize_Setting instance. |
799 * @param WP_Customize_Setting $setting WP_Customize_Setting instance. |
799 */ |
800 */ |
800 $value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this ); |
801 $value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this ); |
801 |
802 |
802 if ( is_string( $value ) ) { |
803 if ( is_string( $value ) ) { |
803 return html_entity_decode( $value, ENT_QUOTES, 'UTF-8' ); |
804 return html_entity_decode( $value, ENT_QUOTES, 'UTF-8' ); |