/**
  * Initialize the class and set its properties.
  *
  * @since 	0.6.5
  * @param 	string    							$plugin_name 			The name of this plugin.
  * @param 	Plugin_Name_Callback_Helper 		$settings_callback 		The callback helper for rendering HTML markups
  * @param 	Plugin_Name_Sanitization_Helper 	$settings_sanitization 	The sanitization helper for sanitizing settings
  */
 public function __construct($plugin_name, $settings_callback, $settings_sanitization)
 {
     $this->plugin_name = $plugin_name;
     $this->callback = $settings_callback;
     $this->sanitization = $settings_sanitization;
     $this->registered_settings = Lss_Tools_Settings_Definition::get_settings();
 }
 /**
  * Settings Sanitization
  *
  * Adds a settings error (for the updated message)
  * At some point this will validate input.
  *
  * Note: All sanitized settings will be saved.
  * Thus, no error messages will be produced.
  *
  * Filters in order:
  * - lss_tools_settings_sanitize_<tab_slug>
  * - lss_tools_settings_sanitize_<type>
  * - lss_tools_settings_sanitize
  * - lss_tools_settings_on_change_<tab_slug>
  * - lss_tools_settings_on_change_<field_key>
  *
  * @since 	0.6.5
  * @param 	array 		$input 		The value inputted in the field
  * @return 	string 		$input 		Sanitizied value
  */
 public function settings_sanitize($input = array())
 {
     if (empty($_POST['_wp_http_referer'])) {
         return $input;
     }
     parse_str($_POST['_wp_http_referer'], $referrer);
     $tab = isset($referrer['tab']) ? $referrer['tab'] : Lss_Tools_Settings_Definition::get_default_tab_slug();
     // Tab filter
     $input = apply_filters('lss_tools_settings_sanitize_' . $tab, $input);
     // Trigger action hook for general settings update for $tab
     $this->do_settings_on_change_hook($input, $tab);
     // Loop through each setting being saved and pass it through a sanitization filter
     foreach ($input as $key => $value) {
         $new_value = $value;
         // set value of $value in $new_value
         $input[$key] = $this->apply_type_filter($input, $tab, $key);
         $input[$key] = $this->apply_general_filter($input, $key);
         $this->do_settings_on_key_change_hook($key, $new_value);
     }
     add_settings_error($this->plugin_name . '-notices', $this->plugin_name, __('Settings updated.', $this->plugin_name), 'updated');
     return $this->get_output($tab, $input);
 }
 /**
  * Initialize the class and set its properties.
  *
  * @since    0.6.5
  * @var      string    $plugin_name       The name of this plugin.
  */
 public function __construct($plugin_name)
 {
     $this->plugin_name = $plugin_name;
     $this->options_tabs = Lss_Tools_Settings_Definition::get_tabs();
 }
 /**
  * Render the settings page for this plugin.
  *
  * @since    1.0.0
  */
 public function display_plugin_admin_page()
 {
     $tabs = Lss_Tools_Settings_Definition::get_tabs();
     $default_tab = Lss_Tools_Settings_Definition::get_default_tab_slug();
     $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ? $_GET['tab'] : $default_tab;
     include_once 'partials/lss-tools-admin-display.php';
 }