get_type example

public function find($type = SIMPLEPIE_LOCATOR_ALL, &$working = null)
    {
        if ($this->is_feed($this->file))
        {
            return $this->file;
        }

        if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
        {
            $sniffer = $this->registry->create('Content_Type_Sniffer', array($this->file));
            if ($sniffer->get_type() !== 'text/html')
            {
                return null;
            }
        }

        if ($type & ~SIMPLEPIE_LOCATOR_NONE)
        {
            $this->get_base();
        }

        if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
        {

    public function get_real_type($find_handler = false)
    {
        // Mime-types by handler.         $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash         $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player         $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime         $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media         $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
        if ($this->get_type() !== null)
        {
            $type = strtolower($this->type);
        }
        else
        {
            $type = null;
        }

        // If we encounter an unsupported mime-type, check the file extension and guess intelligently.         if (!in_array($typearray_merge($types_flash$types_fmedia$types_quicktime$types_wmedia$types_mp3)))
        {
            

            // Change the encoding to UTF-8 (as we always use UTF-8 internally)             if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8')))
            {
                // Create new parser                 $parser = $this->registry->create('Parser');

                // If it's parsed fine                 if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url))
                {
                    $this->data = $parser->get_data();
                    if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE))
                    {
                        $this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed.";
                        $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
                        return false;
                    }

                    if (isset($headers))
                    {
                        $this->data['headers'] = $headers;
                    }
                    $this->data['build'] = SIMPLEPIE_BUILD;

                    
foreach ( $search_handlers as $search_handler ) {
            if ( ! $search_handler instanceof WP_REST_Search_Handler ) {
                _doing_it_wrong(
                    __METHOD__,
                    /* translators: %s: PHP class name. */
                    sprintf( __( 'REST search handlers must extend the %s class.' ), 'WP_REST_Search_Handler' ),
                    '5.0.0'
                );
                continue;
            }

            $this->search_handlers[ $search_handler->get_type() ] = $search_handler;
        }
    }

    /** * Registers the routes for the search controller. * * @since 5.0.0 * * @see register_rest_route() */
    public function register_routes() {
        
Home | Imprint | This part of the site doesn't use cookies.