Jetpack_RelatedPosts::parse_options PHP Method

parse_options() public method

Parses input and returnes normalized options array.
public parse_options ( array $input ) : array
$input array
return array
    public function parse_options($input)
    {
        $current = $this->get_options();
        if (!is_array($input)) {
            $input = array();
        }
        if (isset($input['enabled']) && '1' == $input['enabled']) {
            $current['enabled'] = true;
            $current['show_headline'] = isset($input['show_headline']) && '1' == $input['show_headline'];
            $current['show_thumbnails'] = isset($input['show_thumbnails']) && '1' == $input['show_thumbnails'];
        } else {
            $current['enabled'] = false;
        }
        if (isset($input['size']) && (int) $input['size'] > 0) {
            $current['size'] = (int) $input['size'];
        } else {
            $current['size'] = null;
        }
        return $current;
    }