private function _load_mime_types()
    {

        // if file with mime types was not already loaded
        if (!isset($this->form_properties['mimes'])) {

            // read file into an array
            $rows = file($this->form_properties['assets_server_path'] . 'mimes.json');

            // convert JSON to array
            // i'm aware that in PHP 5.2+ there is json_decode, but i want this library to be
            // as backward compatible as possible so, since the values in mimes.json has a
            // specific structure, i wrote my own decoder
            $this->form_properties['mimes'] = array();

            // iterate through all the rows
            foreach ($rows as $row) {

                // if valid row found
                if (strpos($row, ':') !== false) {

                    // explode the string by :
                    $items = explode(':', $row);

                    // the file type (extension)
                    $index = trim(str_replace('"', '', $items[0]));

                    // if there are more mime types attached
                    if (strpos($items[1], '[') !== false)

                        // convert to array
                        $value = array_diff(array_map('trim', explode(',', str_replace(array('[', ']', '"', '\/'), array('', '', '', '/'), $items[1]))), array(''));

                    // if a single mime type is attached
                    else

                        // convert to string
                        $value = trim(str_replace(array('"', ',', '\/'), array('', '', '/'), $items[1]));

                    // save entry
                    $this->form_properties['mimes'][$index] = $value;

                }

            }

        }

    }
private function _load_mime_types()
    {

        // if file with mime types was not already loaded
        if (!isset($this->form_properties['mimes'])) {

            // read file into an array
            $rows = file($this->form_properties['assets_server_path'] . 'mimes.json');

            // convert JSON to array
            // i'm aware that in PHP 5.2+ there is json_decode, but i want this library to be
            // as backward compatible as possible so, since the values in mimes.json has a
            // specific structure, i wrote my own decoder
            $this->form_properties['mimes'] = array();

            // iterate through all the rows
            foreach ($rows as $row) {

                // if valid row found
                if (strpos($row, ':') !== false) {

                    // explode the string by :
                    $items = explode(':', $row);

                    // the file type (extension)
                    $index = trim(str_replace('"', '', $items[0]));

                    // if there are more mime types attached
                    if (strpos($items[1], '[') !== false)

                        // convert to array
                        $value = array_diff(array_map('trim', explode(',', str_replace(array('[', ']', '"', '\/'), array('', '', '', '/'), $items[1]))), array(''));

                    // if a single mime type is attached
                    else

                        // convert to string
                        $value = trim(str_replace(array('"', ',', '\/'), array('', '', '/'), $items[1]));

                    // save entry
                    $this->form_properties['mimes'][$index] = $value;

                }

            }

        }

    }
private function _load_mime_types ( ) { // if file with mime types was not already loaded if ( ! isset ( $ this -> form_properties [ 'mimes' ] ) ) { // read file into an array $ rows = file ( $ this -> form_properties [ 'assets_server_path' ] . 'mimes.json' ) ; // convert JSON to array // i'm aware that in PHP 5.2+ there is json_decode, but i want this library to be // as backward compatible as possible so, since the values in mimes.json has a // specific structure, i wrote my own decoder $ this -> form_properties [ 'mimes' ] = array ( ) ; // iterate through all the rows foreach ( $ rows as $ row ) { // if valid row found if ( strpos ( $ row , ':' ) !== false ) { // explode the string by : $ items = explode ( ':' , $ row ) ; // the file type (extension) $ index = trim ( str_replace ( '"' , '' , $ items [ 0 ] ) ) ; // if there are more mime types attached if ( strpos ( $ items [ 1 ] , '[' ) !== false ) // convert to array $ value = array_diff ( array_map ( 'trim' , explode ( ',' , str_replace ( array ( '[' , ']' , '"' , '\/' ) , array ( '' , '' , '' , '/' ) , $ items [ 1 ] ) ) ) , array ( '' ) ) ; // if a single mime type is attached else // convert to string $ value = trim ( str_replace ( array ( '"' , ',' , '\/' ) , array ( '' , '' , '/' ) , $ items [ 1 ] ) ) ; // save entry $ this -> form_properties [ 'mimes' ] [ $ index ] = $ value ; } } } }
Load MIME types from mimes.json

@return void

@access private
Load MIME types from mimes . json