fastlinemedia / customizer-export-import

Adds a settings export/import section to the WordPress customizer.
43 stars 13 forks source link

Capability to export and import JSON #6

Closed NoDiskInDriveA closed 5 months ago

NoDiskInDriveA commented 8 years ago

This plugin is extremely useful, however serialized PHP can be hard to read, modify and diff (both manually and automatically, for all kinds of collaboration tools), so I - currently collaborating with others on a wordpress project - felt the need for another format. I chose JSON as it is very readable, well known and comes with all current PHP versions.

My small extension of your plugin adds a JSON export option and also allows for uploading settings in json format (only if available on current PHP runtime).

I'm fairly new to the wordpress ecosystem, so I don't know:

fastlinemedia commented 8 years ago

Hey NoDiskInDriveA,

Thanks for the contribution! I'm not sure if there are any issues with exporting JSON, but I'll have a look this week and get back to you.

Justin

fastlinemedia commented 8 years ago

Hey NoDiskInDriveA,

My apologies for the delay! The PR looks good, but I worry about having two export buttons from a UX standpoint. WordPress typically handles data in a serialized format, so I'm opting to stick with that as the default. Maybe JSON exporting can be enabled with a define?

Let me know what you think.

Justin

BoweFrankema commented 8 years ago

@NoDiskInDriveA I really love this! I've been making a bunch of Theme Presets for my clients and customers and having a JSON file to modify is so much easier.

I'm currently using an action on save to automatically import a exported .dat file with some settings. I would love to switch to JSON import, but I have no idea how I would need to modify my current snippet! Here's what I have now:

https://gist.github.com/BoweFrankema/de6db7889885c7aec04a

It would be extremely awesome if you could help me get this snippet working with your JSON feature :-)