function subscribe() { global $videotube; $name = wp_filter_nohtml_kses($_POST['name']); $email = wp_filter_nohtml_kses($_POST['email']); $agree = wp_filter_nohtml_kses($_POST['agree']); $referer = wp_filter_nohtml_kses($_POST['referer']); $role = isset($videotube['subscribe_roles']) ? $videotube['subscribe_roles'] : 'subscriber'; if (!$name) { echo json_encode(array('resp' => 'error', 'message' => __('Please enter your name.', 'mars'), 'id' => 'name')); exit; } if (!$email || !is_email($email)) { echo json_encode(array('resp' => 'error', 'message' => __('Please enter a valid email address.', 'mars'), 'id' => 'email')); exit; } if ($agree != true || $agree != 'true') { echo json_encode(array('resp' => 'error', 'message' => __('Please agree with our Private Policy.', 'mars'), 'id' => 'agree')); exit; } $user_id = wp_insert_user(array('user_login' => $email, 'user_email' => $email, 'display_name' => $name, 'user_pass' => wp_generate_password(6, true), 'role' => $role)); if (is_wp_error($user_id)) { echo json_encode(array('resp' => 'error', 'message' => $user_id->get_error_message())); exit; } update_user_meta($user_id, 'referer', $referer); echo json_encode(array('resp' => 'success', 'message' => __('Congratulation.', 'mars'), 'redirect_to' => get_permalink($referer))); exit; }
function gardenia_option_validate($input) { $input['logo'] = esc_url_raw($input['logo']); $input['favicon'] = esc_url_raw($input['favicon']); $input['footertext'] = sanitize_text_field($input['footertext']); $input['email'] = sanitize_email($input['email']); $input['phone'] = wp_filter_nohtml_kses($input['phone']); $input['home-title'] = sanitize_text_field($input['home-title']); $input['home-content'] = sanitize_text_field($input['home-content']); $input['post-title'] = sanitize_text_field($input['post-title']); $input['post-content'] = sanitize_text_field($input['post-content']); $input['twitter'] = esc_url_raw($input['twitter']); $input['fburl'] = esc_url_raw($input['fburl']); $input['pinterest'] = esc_url_raw($input['pinterest']); $input['linkedin'] = esc_url_raw($input['linkedin']); $input['gplus'] = esc_url_raw($input['gplus']); $input['rss'] = esc_url_raw($input['rss']); for ($gardenia_i = 1; $gardenia_i <= 5; $gardenia_i++) { $input['slider-img-' . $gardenia_i] = esc_url_raw($input['slider-img-' . $gardenia_i]); $input['slidelink-' . $gardenia_i] = esc_url_raw($input['slidelink-' . $gardenia_i]); } for ($gardenia_section_i = 1; $gardenia_section_i <= 4; $gardenia_section_i++) { $input['home-icon-' . $gardenia_section_i] = esc_url_raw($input['home-icon-' . $gardenia_section_i]); $input['section-title-' . $gardenia_section_i] = sanitize_text_field($input['section-title-' . $gardenia_section_i]); $input['section-content-' . $gardenia_section_i] = sanitize_text_field($input['section-content-' . $gardenia_section_i]); $input['section-link-' . $gardenia_section_i] = esc_url_raw($input['section-link-' . $gardenia_section_i]); } return $input; }
/** * @param $input * @todo streamline validation/sanitization work, replace deprecated function calls */ public function validate_options($input) { $teccc = $this->teccc; foreach ($teccc->terms as $attributes) { $slug = $attributes[Main::SLUG]; // Sanitize textbox input (strip html tags, and escape characters) // May not be needed with jQuery color picker $input[$slug . '-background'] = wp_filter_nohtml_kses($input[$slug . '-background']); $input[$slug . '-background'] = preg_replace('[^#A-Za-z0-9]', '', $input[$slug . '-background']); if ($input[$slug . '-background'] == '') { $input[$slug . '-background'] = '#CFCFCF'; } $input[$slug . '-border'] = wp_filter_nohtml_kses($input[$slug . '-border']); $input[$slug . '-border'] = preg_replace('[^#A-Za-z0-9]', '', $input[$slug . '-border']); if ($input[$slug . '-border'] == '') { $input[$slug . '-border'] = '#CFCFCF'; } // Sets value when checked if (isset($input[$slug . '-border_transparent'])) { $input[$slug . '-border'] = 'transparent'; } if (isset($input[$slug . '-background_transparent'])) { $input[$slug . '-background'] = 'transparent'; } // Sanitize dropdown input (make sure value is one of options allowed) if (!in_array($input[$slug . '-text'], $teccc->text_colors, true)) { $input[$slug . '-text'] = '#000'; } } return $input; }
/** * Send Contact Message * * @param array $data * @return mixed * @throws Exception */ function ale_send_contact($data) { $return = true; try { if (!wp_verify_nonce($_REQUEST['_wpnonce'])) { throw new Exception('Something went wrong. Please refresh the page and try again.'); } foreach ($data as $k => $val) { $data[$k] = wp_filter_nohtml_kses(trim($val)); } if (!$data['name']) { throw new Exception('Please enter your name.'); } if (!is_email($data['email'])) { throw new Exception('Please enter a valid email address.'); } if (!$data['message']) { throw new Exception('Please enter your message.'); } do_action('ale_contact_form_send', $data); $redirectUrl = get_permalink(); $redirectUrl = substr_count($redirectUrl, '?') ? '&success' : '?success'; wp_redirect($redirectUrl); exit; } catch (Exception $e) { $return = array('error' => 1, 'msg' => $e->getMessage()); } return $return; }
function ft_options_validate($input) { $input['logo'] = esc_url_raw($input['logo']); $input['favicon'] = esc_url_raw($input['favicon']); $input['footertext'] = wp_filter_nohtml_kses($input['footertext']); return $input; }
function ar_options_validate($input) { $input['logo'] = esc_url_raw($input['logo']); $input['fevicon'] = esc_url_raw($input['fevicon']); $input['footertext'] = wp_filter_nohtml_kses($input['footertext']); $input['customcss'] = esc_html($input['customcss']); $input['slide1title'] = wp_filter_nohtml_kses($input['slide1title']); $input['slide1subtitle'] = wp_filter_nohtml_kses($input['slide1subtitle']); $input['slide1image'] = esc_url_raw($input['slide1image']); $input['slide2title'] = wp_filter_nohtml_kses($input['slide2title']); $input['slide2subtitle'] = wp_filter_nohtml_kses($input['slide2subtitle']); $input['slide2image'] = esc_url_raw($input['slide2image']); $input['msheading'] = wp_filter_nohtml_kses($input['msheading']); $input['msheadingdes'] = wp_filter_nohtml_kses($input['msheadingdes']); $input['sicon1'] = wp_filter_nohtml_kses($input['sicon1']); $input['fstitle'] = wp_filter_nohtml_kses($input['fstitle']); $input['fdtitle'] = wp_filter_nohtml_kses($input['fdtitle']); $input['sicon2'] = wp_filter_nohtml_kses($input['sicon2']); $input['sstitle'] = wp_filter_nohtml_kses($input['sstitle']); $input['sdtitle'] = wp_filter_nohtml_kses($input['sdtitle']); $input['sicon3'] = wp_filter_nohtml_kses($input['sicon3']); $input['sstitle3'] = wp_filter_nohtml_kses($input['sstitle3']); $input['sdtitle3'] = wp_filter_nohtml_kses($input['sdtitle3']); $input['blogh'] = wp_filter_nohtml_kses($input['blogh']); $input['bloghdd'] = wp_filter_nohtml_kses($input['bloghdd']); return $input; }
private function validateOptions() { return function ($input) { $input['footer_copyright'] = wp_filter_nohtml_kses($input['footer_copyright']); return $input; }; }
function plugin_options_validate($input) { // Check our textbox option field contains no HTML tags - if so strip them out $input['text_string'] = wp_filter_nohtml_kses($input['text_string']); return $input; // return validated input }
public function save_scrib_opts($input) { $r['browseid'] = absint($input['browseid']); $r['searchprompt'] = wp_filter_nohtml_kses($input['searchprompt']); $r['facetfound'] = absint($input['facetfound']); return $r; }
public function vimeography_validate_advanced_settings($input) { $output['client_id'] = wp_filter_nohtml_kses($input['client_id']); $output['client_secret'] = wp_filter_nohtml_kses($input['client_secret']); $output['access_token'] = wp_filter_nohtml_kses($input['access_token']); $output['access_token_secret'] = wp_filter_nohtml_kses($input['access_token_secret']); if ($output['client_id'] == '' || $output['client_secret'] == '' || $output['access_token'] == '' || $output['access_token_secret'] == '') { add_settings_error('vimeography_advanced_settings', 'required', __('Whoops! Make sure you fill out all of the Vimeo tokens!')); return FALSE; } require_once VIMEOGRAPHY_PATH . 'lib/vimeo-advanced-api-library.php'; if (class_exists('phpVimeo')) { $vimeo = new phpVimeo($output['client_id'], $output['client_secret'], $output['access_token'], $output['access_token_secret']); } // Do an authenticated call try { $data = $vimeo->call('vimeo.oauth.checkAccessToken'); if (!$data) { add_settings_error('vimeography_advanced_settings', 'invalid', __('Woah! Looks like the Vimeo API is having some issues right now. Try this again in a little bit.')); return FALSE; } $string = __('Success! Your Vimeo tokens for ') . $data->oauth->user->username . __(' have been added and saved.'); // not actually an error, function name is misleading add_settings_error('vimeography_advanced_settings', 'valid', $string, 'updated'); $output['active'] = TRUE; return $output; } catch (VimeoAPIException $e) { //add_settings_error( 'vimeography_advanced_settings', $e->getCode(), "Encountered an API error -- ".$e->getMessage()); add_settings_error('vimeography_advanced_settings', $e->getCode(), "Uh oh! Your Vimeo tokens didn't validate. Try again, and double check that all of your tokens are in the correct fields!"); return FALSE; } }
/** * Editing a user profile. * @param WP_User $user */ public static function edit_user_profile($user) { global $wpdb; if (current_user_can(GROUPS_ADMINISTER_GROUPS)) { $output = '<h3>' . __('Groups', GROUPS_PLUGIN_DOMAIN) . '</h3>'; $user = new Groups_User($user->ID); $user_groups = $user->groups; $groups_table = _groups_get_tablename('group'); if ($groups = $wpdb->get_results("SELECT * FROM {$groups_table} ORDER BY name")) { $output .= '<ul>'; foreach ($groups as $group) { $is_member = Groups_User_Group::read($user->ID, $group->group_id) ? true : false; $output .= '<li>'; $output .= '<label>'; $output .= sprintf('<input type="checkbox" name="group_ids[]" value="%d" %s />', Groups_Utility::id($group->group_id), $is_member ? ' checked="checked" ' : ''); $output .= ' '; $output .= wp_filter_nohtml_kses($group->name); $output .= '</label>'; $output .= '</li>'; } $output .= '</ul>'; } } echo $output; }
/** * Show add group form. */ function groups_admin_groups_add() { global $wpdb; if (!current_user_can(GROUPS_ADMINISTER_GROUPS)) { wp_die(__('Access denied.', GROUPS_PLUGIN_DOMAIN)); } $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $current_url = remove_query_arg('paged', $current_url); $current_url = remove_query_arg('action', $current_url); $current_url = remove_query_arg('group_id', $current_url); $parent_id = isset($_POST['parent-id-field']) ? $_POST['parent-id-field'] : ''; $name = isset($_POST['name-field']) ? $_POST['name-field'] : ''; $description = isset($_POST['description-field']) ? $_POST['description-field'] : ''; $group_table = _groups_get_tablename('group'); $parent_select = '<select name="parent-id-field">'; $parent_select .= '<option value="">--</option>'; $groups = $wpdb->get_results("SELECT * FROM {$group_table}"); foreach ($groups as $group) { $parent_select .= '<option value="' . esc_attr($group->group_id) . '">' . wp_filter_nohtml_kses($group->name) . '</option>'; } $parent_select .= '</select>'; $output = '<div class="manage-groups">' . '<div>' . '<h2>' . __('Add a new group', GROUPS_PLUGIN_DOMAIN) . '</h2>' . '</div>' . '<form id="add-group" action="' . $current_url . '" method="post">' . '<div class="group new">' . '<div class="field">' . '<label for="name-field" class="field-label first required">' . __('Name', GROUPS_PLUGIN_DOMAIN) . '</label>' . '<input id="name-field" name="name-field" class="namefield" type="text" value="' . esc_attr($name) . '"/>' . '</div>' . '<div class="field">' . '<label for="parent-id-field" class="field-label">' . __('Parent', GROUPS_PLUGIN_DOMAIN) . '</label>' . $parent_select . '</div>' . '<div class="field">' . '<label for="description-field" class="field-label description-field">' . __('Description', GROUPS_PLUGIN_DOMAIN) . '</label>' . '<textarea id="description-field" name="description-field" rows="5" cols="45">' . wp_filter_nohtml_kses($description) . '</textarea>' . '</div>' . '<div class="field">' . wp_nonce_field('groups-add', GROUPS_ADMIN_GROUPS_NONCE, true, false) . '<input class="button" type="submit" value="' . __('Add', GROUPS_PLUGIN_DOMAIN) . '"/>' . '<input type="hidden" value="add" name="action"/>' . '<a class="cancel" href="' . $current_url . '">' . __('Cancel', GROUPS_PLUGIN_DOMAIN) . '</a>' . '</div>' . '</div>' . '</form>' . '</div>'; // .manage-groups echo $output; Groups_Help::footer(); }
/** * Show edit group form. * @param int $group_id group id */ function groups_admin_groups_edit($group_id) { global $wpdb; if (!current_user_can(GROUPS_ADMINISTER_GROUPS)) { wp_die(__('Access denied.', GROUPS_PLUGIN_DOMAIN)); } $group = Groups_Group::read(intval($group_id)); if (empty($group)) { wp_die(__('No such group.', GROUPS_PLUGIN_DOMAIN)); } $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $current_url = remove_query_arg('action', $current_url); $current_url = remove_query_arg('group_id', $current_url); $name = isset($_POST['name-field']) ? $_POST['name-field'] : $group->name; $description = isset($_POST['description-field']) ? $_POST['description-field'] : $group->description; $parent_id = isset($_POST['parent-id-field']) ? $_POST['parent-id-field'] : $group->parent_id; $group_table = _groups_get_tablename('group'); $parent_select = '<select name="parent-id-field">'; $parent_select .= '<option value="">--</option>'; $groups = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$group_table} WHERE group_id != %d", $group->group_id)); foreach ($groups as $g) { $selected = $g->group_id == $group->parent_id ? ' selected="selected" ' : ''; $parent_select .= '<option ' . $selected . 'value="' . esc_attr($g->group_id) . '">' . wp_filter_nohtml_kses($g->name) . '</option>'; } $parent_select .= '</select>'; $name_readonly = $name !== Groups_Registered::REGISTERED_GROUP_NAME ? "" : ' readonly="readonly" '; $output = '<div class="manage-groups">' . '<div>' . '<h2>' . __('Edit a group', GROUPS_PLUGIN_DOMAIN) . '</h2>' . '</div>' . '<form id="edit-group" action="' . $current_url . '" method="post">' . '<div class="group edit">' . '<input id="group-id-field" name="group-id-field" type="hidden" value="' . esc_attr(intval($group_id)) . '"/>' . '<div class="field">' . '<label for="name-field" class="field-label first required">' . __('Name', GROUPS_PLUGIN_DOMAIN) . '</label>' . '<input ' . $name_readonly . ' id="name-field" name="name-field" class="namefield" type="text" value="' . esc_attr($name) . '"/>' . '</div>' . '<div class="field">' . '<label for="parent-id-field" class="field-label">' . __('Parent', GROUPS_PLUGIN_DOMAIN) . '</label>' . $parent_select . '</div>' . '<div class="field">' . '<label for="description-field" class="field-label description-field">' . __('Description', GROUPS_PLUGIN_DOMAIN) . '</label>' . '<textarea id="description-field" name="description-field" rows="5" cols="45">' . wp_filter_nohtml_kses($description) . '</textarea>' . '</div>' . '<div class="field">' . wp_nonce_field('groups-edit', GROUPS_ADMIN_GROUPS_NONCE, true, false) . '<input class="button" type="submit" value="' . __('Save', GROUPS_PLUGIN_DOMAIN) . '"/>' . '<input type="hidden" value="edit" name="action"/>' . '<a class="cancel" href="' . $current_url . '">' . __('Cancel', GROUPS_PLUGIN_DOMAIN) . '</a>' . '</div>' . '</div>' . '</form>' . '</div>'; // .manage-groups echo $output; Groups_Help::footer(); }
protected function _validate_form() { if (isset($_POST['vimeography_basic_settings']) && check_admin_referer('vimeography-gallery-action', 'vimeography-gallery-verification')) { try { $input = $_POST['vimeography_basic_settings']; if (empty($input['gallery_title']) or empty($input['source_url'])) { throw new Exception(__('Make sure you fill out all of the fields below!')); } global $wpdb; $settings['gallery_title'] = $wpdb->escape(wp_filter_nohtml_kses($input['gallery_title'])); $settings['source_url'] = $wpdb->escape(wp_filter_nohtml_kses($input['source_url'])); $result = $wpdb->insert(VIMEOGRAPHY_GALLERY_TABLE, array('title' => $settings['gallery_title'], 'date_created' => current_time('mysql'), 'is_active' => 1)); if (!$result) { throw new Exception(__('We couldn\'t create a new gallery. Try upgrading or reinstalling the Vimeography plugin.')); } else { $gallery_id = $wpdb->insert_id; $result = $wpdb->insert(VIMEOGRAPHY_GALLERY_META_TABLE, array('gallery_id' => $gallery_id, 'source_url' => $settings['source_url'], 'video_limit' => 20, 'featured_video' => NULL, 'gallery_width' => NULL, 'cache_timeout' => 3600, 'theme_name' => 'bugsauce')); if (!$result) { throw new Exception(__('We couldn\'t save your gallery settings. Try reinstalling the Vimeography plugin.')); } } wp_redirect(get_admin_url() . 'admin.php?page=vimeography-edit-galleries&id=' . $gallery_id . '&created=1'); exit; } catch (Exception $e) { require_once ABSPATH . 'wp-admin/admin-header.php'; $this->messages[] = array('type' => 'error', 'heading' => 'Ruh roh.', 'message' => $e->getMessage()); } } }
public function update($new_instance, $old_instance) { $instance = array(); $instance['title'] = wp_filter_nohtml_kses(strip_tags($new_instance['title'])); $instance['youtube_id'] = wp_filter_nohtml_kses(strip_tags($new_instance['youtube_id'])); return $instance; }
function wptmbr_roadblock_options_page() { if (!current_user_can('manage_options')) { wp_die('You do not have sufficient permission to access this page.'); } if (isset($_POST['wptmbr_form_submitted'])) { $hidden_field = $_POST['wptmbr_form_submitted']; if ($hidden_field == 'Y') { $wptmbr_header = wp_filter_nohtml_kses($_POST['wptmbr_header']); $wptmbr_text = wp_filter_nohtml_kses($_POST['wptmbr_text']); $wptmbr_gfid = intval($_POST['wptmbr_gfid']); $options = array(); $options['wptmbr_header'] = $wptmbr_header; $options['wptmbr_text'] = $wptmbr_text; $options['wptmbr_gfid'] = $wptmbr_gfid; $options['last_updated'] = time(); update_option('wptmbr_roadblock', $options); } } $options = get_option('wptmbr_roadblock'); if (!empty($options) && is_array($options)) { $wptmbr_header = $options['wptmbr_header']; $wptmbr_text = $options['wptmbr_text']; $wptmbr_gfid = $options['wptmbr_gfid']; } require 'inc/options-page-wrapper.php'; }
protected function _validate_form() { $url = wp_nonce_url('admin.php?page=vimeography-my-themes'); if (false === ($creds = request_filesystem_credentials($url))) { // if we get here, then we don't have credentials yet, // but have just produced a form for the user to fill in, // so stop processing for now return true; // stop the normal page form from displaying } // now we have some credentials, try to get the wp_filesystem running if (!WP_Filesystem($creds)) { // our credentials were no good, ask the user for them again request_filesystem_credentials($url); return true; } if (empty($_FILES)) { return; } // if this fails, check_admin_referer() will automatically print a "failed" page and die. if (!empty($_FILES) && check_admin_referer('vimeography-install-theme', 'vimeography-theme-verification')) { $name = substr(wp_filter_nohtml_kses($_FILES['vimeography-theme']['name']), 0, -4); if ($_FILES['vimeography-theme']['type'] != 'application/zip') { $this->messages[] = array('type' => 'error', 'heading' => 'Ruh Roh.', 'message' => 'Make sure you are uploading the actual .zip file, not a subfolder or file.'); } else { global $wp_filesystem; if (!unzip_file($_FILES['vimeography-theme']['tmp_name'], VIMEOGRAPHY_THEME_PATH)) { $this->messages[] = array('type' => 'error', 'heading' => 'Ruh Roh.', 'message' => 'The theme could not be installed.'); } else { $this->messages[] = array('type' => 'success', 'heading' => 'Theme installed.', 'message' => 'You can now use the "' . $name . '" theme in your galleries.'); } } } }
function supermag_dynamic_css() { global $supermag_customizer_all_values; /*Color options */ $supermag_primary_color = $supermag_customizer_all_values['supermag-primary-color']; $custom_css = ''; /*background*/ $custom_css .= "\r\n mark,\r\n .comment-form .form-submit input,\r\n .read-more,\r\n .bn-title,\r\n .home-icon.front_page_on,\r\n .header-wrapper .menu li:hover > a,\r\n .header-wrapper .menu > li.current-menu-item a,\r\n .header-wrapper .menu > li.current-menu-parent a,\r\n .header-wrapper .menu > li.current_page_parent a,\r\n .header-wrapper .menu > li.current_page_ancestor a,\r\n .header-wrapper .menu > li.current-menu-item > a:before,\r\n .header-wrapper .menu > li.current-menu-parent > a:before,\r\n .header-wrapper .menu > li.current_page_parent > a:before,\r\n .header-wrapper .menu > li.current_page_ancestor > a:before,\r\n .header-wrapper .main-navigation ul ul.sub-menu li:hover > a,\r\n .slider-section .cat-links a,\r\n .featured-desc .below-entry-meta .cat-links a,\r\n #calendar_wrap #wp-calendar #today,\r\n #calendar_wrap #wp-calendar #today a,\r\n .wpcf7-form input.wpcf7-submit:hover,\r\n .breadcrumb{\r\n background: {$supermag_primary_color};\r\n }\r\n "; $custom_css .= "\r\n a:hover,\r\n .screen-reader-text:focus,\r\n .bn-content a:hover,\r\n .socials a:hover,\r\n .site-title a,\r\n .search-block input#menu-search,\r\n .widget_search input#s,\r\n .search-block #searchsubmit,\r\n .widget_search #searchsubmit,\r\n .footer-sidebar .featured-desc .above-entry-meta a:hover,\r\n .slider-section .slide-title:hover,\r\n .besides-slider .post-title a:hover,\r\n .slider-feature-wrap a:hover,\r\n .slider-section .bx-controls-direction a,\r\n .besides-slider .beside-post:hover .beside-caption,\r\n .besides-slider .beside-post:hover .beside-caption a:hover,\r\n .featured-desc .above-entry-meta span:hover,\r\n .posted-on a:hover,\r\n .cat-links a:hover,\r\n .comments-link a:hover,\r\n .edit-link a:hover,\r\n .tags-links a:hover,\r\n .byline a:hover,\r\n .nav-links a:hover,\r\n #supermag-breadcrumbs a:hover,\r\n .wpcf7-form input.wpcf7-submit {\r\n color: {$supermag_primary_color};\r\n }"; /*border*/ $custom_css .= "\r\n .search-block input#menu-search,\r\n .widget_search input#s,\r\n .tagcloud a{\r\n border: 1px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .footer-wrapper .border,\r\n .nav-links .nav-previous a:hover,\r\n .nav-links .nav-next a:hover{\r\n border-top: 1px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .besides-slider .beside-post{\r\n border-bottom: 3px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .widget-title,\r\n .footer-wrapper,\r\n .page-header .page-title,\r\n .single .entry-header .entry-title{\r\n border-bottom: 1px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .widget-title:before,\r\n .page-header .page-title:before,\r\n .single .entry-header .entry-title:before{\r\n border-bottom: 7px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .wpcf7-form input.wpcf7-submit,\r\n article.post.sticky{\r\n border: 2px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .breadcrumb::after {\r\n border-left: 5px solid {$supermag_primary_color};\r\n }"; $custom_css .= "\r\n .header-wrapper #site-navigation{\r\n border-bottom: 5px solid {$supermag_primary_color};\r\n }"; /*media width*/ $custom_css .= "\r\n @media screen and (max-width:992px){\r\n .slicknav_btn.slicknav_open{\r\n border: 1px solid {$supermag_primary_color};\r\n }\r\n .slicknav_btn.slicknav_open:before{\r\n background: { {$supermag_primary_color} };\r\n box-shadow: 0 6px 0 0 {$supermag_primary_color}, 0 12px 0 0 {$supermag_primary_color};\r\n }\r\n .slicknav_nav li:hover > a,\r\n .slicknav_nav li.current-menu-ancestor a,\r\n .slicknav_nav li.current-menu-item > a,\r\n .slicknav_nav li.current_page_item a,\r\n .slicknav_nav li.current_page_item .slicknav_item span,\r\n .slicknav_nav li .slicknav_item:hover a{\r\n color: {$supermag_primary_color};\r\n }\r\n }"; /*custom css*/ $supermag_custom_css = wp_filter_nohtml_kses($supermag_customizer_all_values['supermag-custom-css']); if (!empty($supermag_custom_css)) { $custom_css .= $supermag_custom_css; } wp_add_inline_style('supermag-style', $custom_css); }
public function validate($input) { // Our first value is either 0 or 1 $input['option1'] = $input['option1'] == 1 ? 1 : 0; // Say our second option must be safe text with no HTML tags $input['sometext'] = wp_filter_nohtml_kses($input['sometext']); return $input; }
function top_message_options_validate($input) { // Say our option must be safe text with no HTML tags $input['vimeo_id'] = wp_filter_nohtml_kses($input['vimeo_id']); $input['flickr_api_key'] = wp_filter_nohtml_kses($input['flickr_api_key']); //$input['flickr_user_id'] = wp_filter_nohtml_kses($input['flickr_user_id']); return $input; }
function rad_opt_sanitize($input) { $clean['phone'] = wp_filter_nohtml_kses($input['phone']); $clean['email'] = wp_filter_nohtml_kses($input['email']); $allowed_tags = array('br' => array(), 'p' => array()); $clean['address'] = wp_kses($input['address'], $allowed_tags); return $clean; }
function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = wp_filter_nohtml_kses(strip_tags($new_instance['title'])); /* Strip tags (if needed) and update the widget settings. */ $instance['text'] = wp_filter_nohtml_kses($new_instance['text']); return $instance; }
public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = wp_filter_nohtml_kses(trim(strip_tags($new_instance['title']))); $instance['num'] = wp_filter_nohtml_kses(trim(strip_tags($new_instance['num']))); $instance['id'] = wp_filter_nohtml_kses(trim(strip_tags($new_instance['id']))); return $instance; }
function validate() { // Strip all html $data = $this->value; $data = wp_filter_nohtml_kses($data); $data = str_replace('>', '>', $data); $this->value = $data; }
/** * Strip Html Tags * * It will sanitize text input (strip html tags, and escape characters) * * @package Easy Digital Downloads - Points and Rewards * @since 1.0.0 */ public function edd_points_nohtml_kses($data = array()) { if (is_array($data)) { $data = array_map(array($this, 'edd_points_nohtml_kses'), $data); } elseif (is_string($data)) { $data = wp_filter_nohtml_kses($data); } return $data; }
function twitter_api_validate($input) { // Say our second option must be safe text with no HTML tags $input['oauth_access_token'] = wp_filter_nohtml_kses($input['oauth_access_token']); $input['oauth_access_token_secret'] = wp_filter_nohtml_kses($input['oauth_access_token_secret']); $input['consumer_key'] = wp_filter_nohtml_kses($input['consumer_key']); $input['consumer_secret'] = wp_filter_nohtml_kses($input['consumer_secret']); return $input; }
function bearded_theme_validate_settings($input) { $socials = bearded_get_social_lists(); foreach ($socials as $key => $val) { $input[$val] = wp_filter_nohtml_kses($input[$val]); } /* Return the array of theme settings. */ return $input; }
function cwp_add_comment_meta_values($comment_id) { for ($i = 1; $i <= cwppos("cwppos_option_nr"); $i++) { if (isset($_POST['meta_option_' . $i])) { ${'meta_option_' . $i} = wp_filter_nohtml_kses($_POST['meta_option_' . $i]); add_comment_meta($comment_id, 'meta_option_' . $i, ${'meta_option_' . $i}, false); } } }
function content_audit_sanitize_options($input) { $options = array(); // valid post types only, please foreach ($input['post_types'] as $post_type) { if (post_type_exists($post_type)) { $options['post_types'][] = $post_type; } } // valid roles only, please foreach ($input['rolenames'] as $role) { if (get_role($role)) { $options['rolenames'][] = $role; } } // do not save injected options if (in_array($input['interval'], array('daily', 'weekly', 'monthly'))) { $options['interval'] = $input['interval']; } if (in_array($input['outdate_unit'], array('days', 'weeks', 'months', 'years'))) { $options['outdate_unit'] = $input['outdate_unit']; } if (in_array($input['display'], array('above', 'below'))) { $options['display'] = $input['display']; } // these should all be zero or one $options['display_switch'] = absint($input['display_switch']); if ($options['display_switch'] > 1) { $options['display_switch'] = 0; } $options['mark_outdated'] = absint($input['mark_outdated']); if ($options['mark_outdated'] > 1) { $options['mark_outdated'] = 0; } $options['notify'] = absint($input['notify']); if ($options['notify'] > 1) { $options['notify'] = 0; } $options['notify_now'] = absint($input['notify_now']); if ($options['notify_now'] > 1) { $options['notify_now'] = 0; } $options['notify_authors'] = absint($input['notify_authors']); if ($options['notify_authors'] > 1) { $options['notify_authors'] = 0; } // this can be any integer $options['outdate'] = absint($input['outdate']); // sanitize css $options['css'] = wp_filter_nohtml_kses($input['css']); /* // testing var_dump( $input ); var_dump( $options ); exit; /**/ return $options; }
function wpsdc_sanitize_options($input) { $input['option_display_mode'] = wp_filter_nohtml_kses($input['option_display_mode']); $input['option_font_size'] = sanitize_text_field(absint($input['option_font_size'])); $input['option_font_color'] = sanitize_text_field($input['option_font_color']); $input['option_custom_css'] = esc_textarea($input['option_custom_css']); $input['option_enable_all_posts'] = wp_filter_nohtml_kses($input['option_enable_all_posts']); return $input; }