Jeradin / acf-website-field

Advanced Custom Fields add-on for Website URLs, allows for website URL, title and a checkbox to open externally or internally
59 stars 14 forks source link

'http://' is not attached, if an array is returned #18

Closed SahinU88 closed 9 years ago

SahinU88 commented 10 years ago

hi there!

first of all nice plugin. it is doing it's work. i just noticed, that if i choose to return an array, then the 'http://' is not attached to the url.

don't know if you wanted it that way, but i think it should be consistent, so i thought i will inform you.

jmslbam commented 10 years ago

Yupp saw that to today This fixed it and some notices btw ;)

Hope to create a PR for this, else just copy+pasta it.

            //return array
            $url = 'http://' . $this->nicifyUrl( $value['url'] );

            $value = array(
                'title' => ( !empty( $value['title'] ) ) ? $value['title'] : '',
                'url' => $url,
                'external' => ( !empty( $value['external'] ) ) ? $value['external'] : ''
            );

Ciao!

jmslbam commented 10 years ago

Btw, maybe also do a empty check when returning?

Jeradin commented 9 years ago

Fixed both issues, before it save saving just the url without "http://" which was messy and foolish of me. Now it checks if that is missing and adds it on output, but not for the returning of array, if it returns an array it uses the default database value.