Giter Site home page Giter Site logo

divinestaroptions's Introduction

Divine Star Options

The Divine Star Options Form

Currently under development. This will be a simple WordPress theme or plugins options framework.

Important Note

Just to be clear. Do not use this to store important information such as passwords or emails. This is mostly for styling options or basic settings. Since all the data is stored in JSON in plain text.

Some key design princples that are being follwed for this.

  • Make the workflow and integration easy and intuitive.
  • Make it very easy to customize and add custom option types.
  • Ensure the form is accessible and is up to WordPress standards.
  • Store all data in JSON.
    • You can also store different sets of options in different files. Load what you need when you need it.
  • Build the form and data structures from XML.
  • The options form will be made with plain JavaScript.
    • In early development some code may be jQuery and then converted to JS.
    • This is will be done to future proof the design for the coming years.

Installing

This process will change as the development goes along. But as of now all you need to do is download the code and put it in your theme's or plugin's folder.

Before You Begin

All the data for Divine Star Options is stored in XML and JSON files. XML files are used to create the form and the structure of the JSON while JSON just stores the name and values of the options. Create a blank XML and JSON file then make move the XML file into the xml folder and the JSON file into the data folder. Then make them writable. One method is through chmod command.

dsm:divinestaroptions Admin$ touch generaloptions.xml
dsm:divinestaroptions Admin$ touch generaloptions.json
dsm:divinestaroptions Admin$ mv generaloptions.xml xml
dsm:divinestaroptions Admin$ mv generaloptions.json data
dsm:divinestaroptions Admin$ chmod 777 xml/generaloptions.xml
dsm:divinestaroptions Admin$ chmod 777 data/generaloptions.json

Setting Up In PHP

Include the files where you need them and look at the example set up below.

//Include the Divine Star Options files.
include('divinestaroptions/divinestaroptions.php');
include('divinestaroptions/divinestaroptionsform.php');

/*
*Define the option path. This is where the divinestaroptions folder is.
*This is used to update the files. 
*/
define( 'OPTIONS_PATH', plugin_dir_path( __FILE__ ).'src/options/divinestaroptions/' );
//Create the options and the form class. 
$dsbo = new DivineStarOptions();
$dsbof = new DivineStarOptionsForm();

/*
*Setting Up the JSON Storage
*This function will create the structure of the JSON file from the XML file. 
*Just supply it with the name of the XML file you made for the form. No need for the .XML extension. 
*/
$dsbo->load_into_files('generaloptions');

/*
*Getting an option. 
*First load the option set that you would like to pull from. 
*Then call get_option with the name of the option that you set. 
*/
$dsbo->load_options('generaloptions');
$value = $dsbo->get_option('test1');

/*
*Outputting the Options Form
*This function will echo out the form right here.
*Just supply it with the name of the XML file you made for the form. No need for the .XML extension. 
*/
$dsbof->get_options_form('generaloptions');


/*
*Integrating Updating With WordPress
*The options form uses javascript ajax calls to update the form. 
*Thus we need to add the update function to WordPress Ajax API. 
*The process is very simple. Just use this code and the method will be added. 
*Please do not change the action name. 
*/
add_action( 'wp_ajax_divine_star_updateoptions', array( $dsbo,'update_options') );

divinestaroptions's People

Contributors

lucasdamianjohnson avatar

Stargazers

 avatar

Watchers

 avatar

divinestaroptions's Issues

Add input type of image

Figure out a way to integrate the WordPress image gallery into options to allow for easy storage of image URLs as options.

Add support for custom options not in form.

I would like to add support for adding options that do not show up in the form at all.
This would be a generic option tag that is stored in the json.
This could be used in junction with custom HTML to create custom option fields.
This could also be used to create a static option.

Options Menu Reacting to the WordPress menu

If the options menu is going to be next to the WP menu it needs to react to when it is collapsed. I added some testing for this but I will have to get it fully working later. Or I may have to make it more built into the page.
I am labeling this as a bug for now.

Make sidebar menu responsive.

Make the righthand sidebar menu responsive.
This will require some testing. The current behavior from the default WordPress structure is not very functional.

Add option type of custom code.

Add an option type to allow the user to add a code input for their options form.
This could be to add custom CSS or JS to a site.
Would be best to try to find a way to implement syntax highlighting.
I will need to find something to do that.

Menu button bug

Something I noticed. When hovering over the menu of the not currently active menu as soon as your mouse moves down to the submenu options the background for the main section text goes away.
I will have to spend some time figuring out what is causing it.

Search Dropdown CSS broken on Chrome for Android.

I tried viewing the search dropdown from Chrome on my android phone and found the the buttons are not where they are supposed to be. It looks very broken. It however looks great on Firefox for Android so I don't know.

Create message system.

Create a system to display messages to the user.
It will need to display when there are unsaved changes and when the changes have been successfully updated.

Add Drag and Drop modes

I will be adding several different modes for the drag and drop options.
This will be basically implementing the various capabilities of Sortable JS into the DS options.
This includes

  • Cloning from list to another
  • Shared list
  • Swap list
  • Nested list
  • Different Handles
  • Grids

This may not be the most accessible thing. I am not sure. I will try to make it with the keyboard and if it does not I may have to make a fallback option if a person needs it. The accessible interface would have arrow buttons to move the elements where you want them.

Create top and bottom options.

Create a top and bottom option to save or load defaults for the current form.
The bottom bar should be sticky if the top bar is out of view.
All of this should be contained in the options form panel itself.

Create way to access option data from a JS Script

There may need to access option data inside of a JS script.
This would be the case on the front end when the you do not want to echo out the values into a JS script but rather get them from an object.
Much like how the WordPress ajax object works.

Add drag and drop able options

Add support for rearrangeable options.
This will be important for things where you can the order is important and you would want the user to have flexibility in the order of things.

Add a option type of toggle

This will be kind of like a checkbox but you have it be anything you would like.
For example "Yes/No" "Dark/Light" and so on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.