- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 5-6 years
- Referred between 1 and 9 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 5 000 and 10 000 dollars
- Uruguay
Well… let´s see if anybody…...
I´m under this situation, i build an options theme page, and i can export and import options using a textarea where i can copy and paste, or even save manualy into a .txt file.
That´s ok and works fine. But i was tring to save that into a text file, i could, but once i get the text file loaded to convet it on an update_option or similar via ddbb query, i fail.
And i fail using everything.
The problem is i can´t with the sanitize and html entities, for example, all & must be &, on the textarea no problem, but, if i just leave one & no-encoded, the uploader fails to create the option array and nothing is created.
Any ideas? I whis to know how to this, i was all day fighting with that.
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 5-6 years
- Referred between 1 and 9 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 5 000 and 10 000 dollars
- Uruguay
ok, nevermind, i will get this in the next days for sure.
I notice that i´ve posted many threads pointing to “real” hard code wp theme (options mainly), and on those casese, 0 reply…. sometimes i forget that this is a place “only” to make money and not to share how to do it…. anyway, as i said, i will get soon.
I will keep my self as always, and if i can share and help, i´ll do, i do not keep secrets.
cheers.
don´t take me wrong, this is what i feel.
rg, i am one of those guys who read with attention your posts with solutions and tricks. many thanks for your share.
- Referred more than 2000 users
- Power Elite Author: Sold between 2 000 000 - 4 999 999 dollars
- Author was Featured
- Item was Featured
- Austria
- Bought between 100 and 499 items
- Has been a member for 4-5 years
- Interviewed on the Envato Notes blog
I would recommend to use base64 en and decoding:
http://php.net/manual/en/function.base64-encode.php
it is designed to make binary data survive transport through transport layers. This would work fine for import and export, however I don’t know if you want to be able to add additional options to a textarea and import them; then this probably wont be a useful solution. Nevertheless I thought it might be interesting 
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Egypt
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
What I do in my options panel is to save all options in a single array in the database, for the export feature I serialize the array, base64 encode it then save it in a txt file with force download using php headers. then when its comes to the import, the user upload the txt file imported, base64 decode it then update the database option row with out unserializing and thats it
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 5-6 years
- Referred between 1 and 9 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 5 000 and 10 000 dollars
- Uruguay
Oh! thank you guys i was starting to feel a little alone on the forum, i´m the only one from Uruguay, and in fact there are only a few active users from southamerica, so….
Ok, thanks again for the replys, i will take in consideration that.
I guess what i´m doing wrong is to keep on same export file, options and also the data stroed in there. For example in my text file i save all the entire array for the only one option field i use (yes wizylabs i use arrays as you) and then, some html text brake the imort, like ampersands and those things.
The strage thing is, when i echo the option array as string in the text area, the ampersands are unenecode, but on the ddbb filed are encoded…..
Any way… i will keep on this till i get it!

