SimplePie_Misc::atom_10_content_construct_type PHP Method

atom_10_content_construct_type() public method

public atom_10_content_construct_type ( $attribs )
    function atom_10_content_construct_type($attribs)
    {
        if (isset($attribs['']['type'])) {
            $type = strtolower(trim($attribs['']['type']));
            switch ($type) {
                case 'text':
                    return SIMPLEPIE_CONSTRUCT_TEXT;
                case 'html':
                    return SIMPLEPIE_CONSTRUCT_HTML;
                case 'xhtml':
                    return SIMPLEPIE_CONSTRUCT_XHTML;
            }
            if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') {
                return SIMPLEPIE_CONSTRUCT_NONE;
            } else {
                return SIMPLEPIE_CONSTRUCT_BASE64;
            }
        } else {
            return SIMPLEPIE_CONSTRUCT_TEXT;
        }
    }

Usage Example

Example #1
0
 public function get_content($content_only = false)
 {
     if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) {
         return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0]));
     } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) {
         return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
     } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) {
         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
     } elseif (!$content_only) {
         return $this->get_description(true);
     } else {
         return null;
     }
 }