summaryrefslogtreecommitdiffstats
path: root/include/options-register.php
diff options
context:
space:
mode:
authordanix <danix@danix.xyz>2018-07-04 18:03:21 +0200
committerdanix <danix@danix.xyz>2018-07-04 18:03:21 +0200
commit80ada5400b9bcfcccc1ac741727dc6dfc04896e8 (patch)
treee4786290717df8162b2612db73adb405bdb6f17e /include/options-register.php
downloaddanixland-user-panel-80ada5400b9bcfcccc1ac741727dc6dfc04896e8.tar.gz
danixland-user-panel-80ada5400b9bcfcccc1ac741727dc6dfc04896e8.zip
initial commitHEADmaster
Diffstat (limited to 'include/options-register.php')
-rw-r--r--include/options-register.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/options-register.php b/include/options-register.php
new file mode 100644
index 0000000..506a17b
--- /dev/null
+++ b/include/options-register.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * Register the set of options required for the plugin to work
+ * @since 1.1.1
+ */
+register_setting( 'dnxup_options', 'dnxup_options', 'dnxup_setup_validate' );
+
+// include the file with the actual markup for the options to display
+require( dirname( __FILE__ ) . '/plugin-options.php' );
+
+
+function dnxup_setup_validate($input) {
+
+ $dnxup_options = get_option('dnxup_options');
+ $valid_input = $dnxup_options;
+
+ $submit = ( ! empty( $input['submit'] ) ? true : false );
+ $reset = ( ! empty( $input['reset'] ) ? true : false );
+
+ if($submit) {
+ $default_options = dnxup_db_defaults();
+ // Show Gravatar
+ $valid_input['show_gravatar'] = ( true == $input['show_gravatar'] ? true : false );
+ // Logged out Heading
+ $valid_input['logged_out_heading'] = ( '' == $input['logged_out_heading'] ? '' : wp_filter_nohtml_kses($input['logged_out_heading']) );
+ // Logged in Heading
+ $valid_input['logged_in_heading'] = ( '' == $input['logged_in_heading'] ? '' : wp_filter_nohtml_kses($input['logged_in_heading']) );
+ // Logged in Links
+ $valid_data = array(
+ 'a' => array(
+ 'href' => array(),
+ 'title' => array(),
+ 'class' => array(),
+ 'id' => array()
+ )
+ );
+ $valid_input['logged_in_links'] = ('' == $input['logged_in_links'] ? '' : wp_kses($input['logged_in_links'], $valid_data) );
+ } elseif($reset) {
+ $default_options = dnxup_db_defaults();
+ // Show Gravatar
+ $valid_input['show_gravatar'] = $default_options['show_gravatar'];
+ // Logged out Heading
+ $valid_input['logged_out_heading'] = $default_options['logged_out_heading'];
+ // Logged in Heading
+ $valid_input['logged_in_heading'] = $default_options['logged_in_heading'];
+ // Logged in Links
+ $valid_input['logged_in_links'] = $default_options['logged_in_links'];
+ }
+ return $valid_input;
+}
+?> \ No newline at end of file