includes(); global $ss_standards, $options; $ss_standards = get_option('silentsalesman'); add_action('admin_menu', array(&$this, 'silentsalesman_add_page')); } public function includes() { include_once( 'plugins/ss_404.php' ); include_once( 'plugins/ss_woocommerce.php' ); } /** * Add menu page */ public function silentsalesman_add_page() { $silentsalesman_page = add_submenu_page('edit.php?post_type=page', __('Silent Salesman', 'silentsalesman'), __('Silent Salesman', 'silentsalesman'), 'manage_options', 'silentsalesman_options_page', array($this, 'silentsalesman_options_do_page')); } /** * Build the options page. */ public function silentsalesman_options_do_page() { ?>

This feature is only available in the pro version, but get a 25% discount if you're one
of the first 20 buyers! See below for more info.


-


'; printf (__('Need to see more? %sClick here%s to check it out!','silentsalesman'), $menucartadmore,''); ?>

', $id, $menu, $current, $size, $disabled); // Displays option description. if (isset($args['description'])) { $html .= sprintf('

%s

', $args['description']); } echo $html; } /** * Search Editor. * * @param array $args Field arguments. * * @return string Text field. */ public function searcheditor_element_callback($args) { $menu = $args['menu']; $id = $args['id']; $size = isset($args['size']) ? $args['size'] : '25'; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($args['default']) ? $args['default'] : ''; } $disabled = (isset($args['disabled'])) ? ' disabled' : ''; //$html = sprintf('', $id, $menu, $current, $size, $disabled); $html = wp_editor($current, 'sssearcheditor'); // Displays option description. if (isset($args['description'])) { $html .= sprintf('

%s

', $args['description']); } echo $html; } /** * 404 Editor * * @param array $args Field arguments. * * @return string Text field. */ public function editor_element_callback($args) { global $wp_version; $menu = $args['menu']; $id = $args['id']; $size = isset($args['size']) ? $args['size'] : '25'; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($args['default']) ? $args['default'] : ''; } $disabled = (isset($args['disabled'])) ? ' disabled' : ''; $html = sprintf(''; //if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { //$html = wp_editor( $current, 'sseditor' ); //} // Displays option description. if (isset($args['description'])) { $html .= sprintf('

%s

', $args['description']); } echo $html; } /** * Displays a selectbox for a settings field * * @param array $args settings field args */ public function select_element_callback($args) { $menu = $args['menu']; $id = $args['id']; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($args['default']) ? $args['default'] : ''; } $disabled = (isset($args['disabled'])) ? ' disabled' : ''; $html = sprintf(''); if (isset($args['description'])) { $html .= sprintf('

%s

', $args['description']); } echo $html; } /** * Displays a multiple selectbox for a settings field * * @param array $args settings field args */ public function multiple_select_element_callback($args) { $html = ''; foreach ($args as $id => $boxes) { $menu = $boxes['menu']; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($boxes['default']) ? $boxes['default'] : ''; } $disabled = (isset($boxes['disabled'])) ? ' disabled' : ''; $html .= sprintf(''; if (isset($boxes['description'])) { $html .= sprintf('

%s

', $boxes['description']); } $html .= '
'; } echo $html; } /** * Checkbox field callback. * * @param array $args Field arguments. * * @return string Checkbox field. */ public function checkbox_element_callback($args) { $menu = $args['menu']; $id = $args['id']; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($args['default']) ? $args['default'] : ''; } $disabled = (isset($args['disabled'])) ? ' disabled' : ''; $html = sprintf('', $id, $menu, checked(1, $current, false), $disabled); // Displays option description. if (isset($args['description'])) { $html .= sprintf('

%s

', $args['description']); } echo $html; } /** * Displays a multicheckbox a settings field * * @param array $args settings field args */ public function radio_element_callback($args) { $menu = $args['menu']; $id = $args['id']; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($args['default']) ? $args['default'] : ''; } $html = ''; foreach ($args['options'] as $key => $label) { $html .= sprintf('', $menu, $id, $key, checked($current, $key, false)); $html .= sprintf('
', $menu, $id, $key, $label); } // Displays option description. if (isset($args['description'])) { $html .= sprintf('

%s

', $args['description']); } echo $html; } /** * Displays a multicheckbox a settings field * * @param array $args settings field args */ public function icons_radio_element_callback($args) { $menu = $args['menu']; $id = $args['id']; $ss_standards = get_option($menu); if (isset($ss_standards[$id])) { $current = $ss_standards[$id]; } else { $current = isset($args['default']) ? $args['default'] : ''; } $icons = ''; $radios = ''; foreach ($args['options'] as $key => $iconnumber) { $icons .= sprintf('', $menu, $id, $key, $iconnumber); $radios .= sprintf('', $menu, $id, $key, checked($current, $key, false)); } $html = '' . $icons . '' . $radios . '
'; $html .= '

' . __('Please note: you need to open your website in a new tab/browser window after updating the cart icon for the change to be visible!', 'silentsalesman') . '

'; echo $html; } /** * Section null callback. * * @return void. */ public function section_options_callback() { } /** * Validate/sanitize options input */ public function silentsalesman_options_validate($input) { // Create our array for storing the validated options. $output = array(); // Loop through each of the incoming options. foreach ($input as $key => $value) { // Check to see if the current option has a value. If so, process it. if (isset($input[$key])) { // Strip all HTML and PHP tags and properly handle quoted strings. $output[$key] = strip_tags(stripslashes($input[$key])); } } // Return the array processing any additional functions filtered by this action. return apply_filters('silentsalesman_validate_input', $output, $input); } }