TitanFrameworkOption::getValue PHP Méthode

getValue() public méthode

public getValue ( $postID = null )
    public function getValue($postID = null)
    {
        $value = false;
        if (empty($this->settings['id'])) {
            return $value;
        }
        if ($this->type == self::TYPE_ADMIN) {
            $value = $this->getFramework()->getInternalAdminPageOption($this->settings['id'], $this->settings['default']);
        } else {
            if ($this->type == self::TYPE_META) {
                if (empty($postID)) {
                    $postID = $this->owner->postID;
                }
                // If no $postID is given, try and get it if we are in a loop.
                if (empty($postID) && !is_admin() && get_post() != null) {
                    $postID = get_the_ID();
                }
                // for meta options, use the default value for new posts/pages
                if (metadata_exists('post', $postID, $this->getID())) {
                    $value = get_post_meta($postID, $this->getID(), true);
                } else {
                    $value = $this->settings['default'];
                }
            } else {
                if ($this->type == self::TYPE_CUSTOMIZER) {
                    $value = get_theme_mod($this->getID(), $this->settings['default']);
                }
            }
        }
        /**
         * Allow others to change the value of the option before it gets cleaned
         *
         * @since 1.9.2
         */
        $value = apply_filters('tf_pre_get_value_' . $this->getOptionNamespace(), $value, $postID, $this);
        // Apply cleaning method for the value (for serialized data, slashes, etc).
        $value = $this->cleanValueForGetting($value);
        /**
         * Allow others to change the value of the option after it gets cleaned
         *
         * @since 1.9
         */
        return apply_filters('tf_get_value_' . $this->settings['type'] . '_' . $this->getOptionNamespace(), $value, $postID, $this);
    }