本文整理汇总了PHP中wp_kses_stripslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_kses_stripslashes函数的具体用法?PHP wp_kses_stripslashes怎么用?PHP wp_kses_stripslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_kses_stripslashes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: hybrid_get_setting
/**
* Loads the Hybrid theme settings once and allows the input of the specific field the user would
* like to show. Hybrid theme settings are added with 'autoload' set to 'yes', so the settings are
* only loaded once on each page load.
*
* @since 0.7.0
* @access public
* @uses get_option() Gets an option from the database.
* @uses hybrid_get_prefix() Gets the prefix of the theme.
* @global object $hybrid The global Hybrid object.
* @param string $option The specific theme setting the user wants.
* @return mixed $settings[$option] Specific setting asked for.
*/
function hybrid_get_setting($option = '')
{
global $hybrid;
/* If no specific option was requested, return false. */
if (!$option) {
return false;
}
/* Get the default settings. */
$defaults = hybrid_get_default_theme_settings();
/* If the settings array hasn't been set, call get_option() to get an array of theme settings. */
if (!isset($hybrid->settings) || !is_array($hybrid->settings)) {
$hybrid->settings = get_option(hybrid_get_prefix() . '_theme_settings', $defaults);
}
/* If the option isn't set but the default is, set the option to the default. */
if (!isset($hybrid->settings[$option]) && isset($defaults[$option])) {
$hybrid->settings[$option] = $defaults[$option];
}
/* If no option is found at this point, return false. */
if (!isset($hybrid->settings[$option])) {
return false;
}
/* If the specific option is an array, return it. */
if (is_array($hybrid->settings[$option])) {
return $hybrid->settings[$option];
} else {
return wp_kses_stripslashes($hybrid->settings[$option]);
}
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:41,代码来源:settings.php
示例2: _doSections
/**
* Handles the sections for
* both quizzes and surveys.
*
* @since 2.0
*/
public function _doSections()
{
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$nameNeeded = array();
for ($row = 0; $row < intval($_POST['row_count']); $row++) {
if (!isset($_POST['section_name'][$row]) || $_POST['section_name'][$row] == "") {
$nameNeeded[] = $row;
continue;
}
$sectionName = wp_kses_stripslashes($_POST['section_name'][$row]);
if (!isset($_POST['number'][$row]) || $_POST['number'][$row] == "") {
$_POST['number'][$row] = 0;
}
if (!isset($_POST['sectionid'][$row]) || empty($_POST['sectionid'][$row])) {
$difficulty = isset($_POST['difficulty'][$row]) ? $_POST['difficulty'][$row] : false;
Wpsqt_System::insertSection($_GET['id'], $sectionName, $_POST['number'][$row], $_POST['order'][$row], $difficulty);
continue;
}
if (isset($_POST['delete'][$row]) && !empty($_POST['delete'][$row])) {
Wpsqt_System::deleteSection($_POST['sectionid'][$row]);
} else {
$difficulty = isset($_POST['difficulty'][$row]) ? $_POST['difficulty'][$row] : false;
Wpsqt_System::updateSection($_POST['sectionid'][$row], $sectionName, $_POST['number'][$row], $_POST['order'][$row], $difficulty);
}
}
$this->_pageVars['successMessage'] = "Sections updated";
}
$validData = Wpsqt_System::fetchSections($_GET['id']);
if (!empty($validData)) {
$this->_pageVars['validData'] = $validData;
}
}
开发者ID:rvarbanov-old,项目名称:WP-Survey-And-Quiz-Tool,代码行数:38,代码来源:Sections.php
示例3: of_sanitize_textarea
function of_sanitize_textarea($input)
{
// global $allowedposttags;
// $output = wp_kses( $input, $allowedposttags);
$output = wp_kses_stripslashes($input);
return $output;
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:7,代码来源:options-sanitize.php
示例4: wp_kses_split2
function wp_kses_split2($string, $allowed_html, $allowed_protocols)
{
$string = wp_kses_stripslashes($string);
if (substr($string, 0, 1) != '<') {
return '>';
}
# It matched a ">" character
if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) {
$string = str_replace(array('<!--', '-->'), '', $matches[1]);
while ($string != ($newstring = wp_kses($string, $allowed_html, $allowed_protocols))) {
$string = $newstring;
}
if ($string == '') {
return '';
}
return "<!--{$string}-->";
}
# Allow HTML comments
if (!preg_match('%^<\\s*(/\\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) {
return '';
}
# It's seriously malformed
$slash = trim($matches[1]);
$elem = $matches[2];
$attrlist = $matches[3];
if (!@isset($allowed_html[strtolower($elem)])) {
return '';
}
# They are using a not allowed HTML element
if ($slash != '') {
return "<{$slash}{$elem}>";
}
# No attributes are allowed for closing elements
return wp_kses_attr("{$slash}{$elem}", $attrlist, $allowed_html, $allowed_protocols);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:35,代码来源:kses.php
示例5: wp_kses_split2
function wp_kses_split2($string, $allowed_html, $allowed_protocols, $cutoff = true)
{
$string = wp_kses_stripslashes($string);
if (substr($string, 0, 1) != '<') {
return '>';
}
# It matched a ">" character
if (!preg_match('%^<\\s*(/\\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) {
# It's seriously malformed
if ($cutoff) {
//hacked by NobuNobu to display not allowed element with < >
return '';
} else {
return str_replace(array('<', '>'), array('<', '>'), $string);
}
}
$slash = trim($matches[1]);
$elem = $matches[2];
$attrlist = $matches[3];
if (!isset($allowed_html[strtolower($elem)]) || !is_array($allowed_html[strtolower($elem)])) {
# They are using a not allowed HTML element
if ($cutoff) {
return '';
} else {
//hacked by NobuNobu to display not allowed element with < >
return str_replace(array('<', '>'), array('<', '>'), $string);
}
}
if ($slash != '') {
return "<{$slash}{$elem}>";
}
# No attributes are allowed for closing elements
return wp_kses_attr("{$slash}{$elem}", $attrlist, $allowed_html, $allowed_protocols);
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:34,代码来源:kses.php
示例6: update
/**
* update the particular instant
*
* This function should check that $new_instance is set correctly.
* The newly calculated value of $instance should be returned.
* If "false" is returned, the instance won't be saved/updated.
*
* $new_instance New settings for this instance as input by the user via form()
* $old_instance Old settings for this instance
* Settings to save or bool false to cancel saving
*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = stripslashes($new_instance['title']);
$instance['adcode'] = wp_kses_stripslashes($new_instance['adcode']);
$instance['image'] = esc_url_raw($new_instance['image']);
$instance['href'] = esc_url_raw($new_instance['href']);
$instance['alt'] = sanitize_text_field($new_instance['alt']);
return $instance;
}
开发者ID:ramo01,项目名称:1kapp,代码行数:21,代码来源:widgets.php
示例7: omega_customize_footer_content_ajax
/**
* Runs the footer content posted via Ajax through the do_shortcode() function. This makes sure the
* shortcodes are output correctly in the live preview.
*
* @since 1.4.0
* @access private
*/
function omega_customize_footer_content_ajax()
{
/* Check the AJAX nonce to make sure this is a valid request. */
check_ajax_referer('omega_customize_footer_content_nonce');
/* If footer content has been posted, run it through the do_shortcode() function. */
if (isset($_POST['footer_content'])) {
echo do_shortcode(wp_kses_stripslashes($_POST['footer_content']));
}
/* Always die() when handling Ajax. */
die;
}
开发者ID:ninthlink,项目名称:edtech,代码行数:18,代码来源:custom-footer.php
示例8: genesis_get_custom_field
function genesis_get_custom_field($field)
{
global $post;
$custom_field = get_post_meta($post->ID, $field, true);
if ($custom_field) {
// sanitize and return the value of the custom field
return wp_kses_stripslashes(wp_kses_decode_entities($custom_field));
} else {
// return FALSE if custom field is empty
return FALSE;
}
}
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:12,代码来源:general_functions.php
示例9: simplehooks_get_option
/**
* Pull an Simple Hooks option from the database, return value
*
* @since 0.1
*/
function simplehooks_get_option($hook = null, $field = null, $all = false)
{
static $options = array();
$options = $options ? $options : get_option(SIMPLEHOOKS_SETTINGS_FIELD);
if ($all) {
return $options;
}
if (!array_key_exists($hook, (array) $options)) {
return '';
}
$option = isset($options[$hook][$field]) ? $options[$hook][$field] : '';
return wp_kses_stripslashes(wp_kses_decode_entities($option));
}
开发者ID:nkeat12,项目名称:dv,代码行数:18,代码来源:functions.php
示例10: update
public function update($new, $old)
{
$instance = $old;
$instance['title'] = strip_tags($new['title']);
$instance['headline'] = wp_kses_stripslashes($new['headline']);
$instance['tagline'] = wp_kses_stripslashes($new['tagline']);
$instance['image'] = $new['image'];
$instance['thumbnail'] = $new['thumbnail'];
$instance['action_url'] = esc_url_raw($new['action_url']);
$instance['action_label'] = wp_kses_stripslashes($new['action_label']);
$instance['action_color'] = wp_kses_stripslashes($new['action_color']);
$instance['alignment'] = wp_kses_stripslashes($new['alignment']);
return $instance;
}
开发者ID:windyjonas,项目名称:fredrika,代码行数:14,代码来源:openstrap-front-page-text.php
示例11: mt_register_settings
function mt_register_settings()
{
if (!empty($_POST['lib_options']) && check_admin_referer('maintenance_edit_post', 'maintenance_nonce')) {
if (!isset($_POST['lib_options']['state'])) {
$_POST['lib_options']['state'] = 0;
} else {
$_POST['lib_options']['state'] = 1;
}
if (isset($_POST['lib_options']['htmlcss'])) {
$_POST['lib_options']['htmlcss'] = wp_kses_stripslashes($_POST['lib_options']['htmlcss']);
}
if (isset($_POST['lib_options'])) {
update_option('maintenance_options', $_POST['lib_options']);
}
}
}
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:16,代码来源:admin.php
示例12: wp_kses_split2
function wp_kses_split2($string, $allowed_html, $allowed_protocols)
{
$string = wp_kses_stripslashes($string);
if (substr($string, 0, 1) != '<') {
return '>';
}
# It matched a ">" character
if (!preg_match('%^<\\s*(/\\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) {
return '';
}
# It's seriously malformed
$slash = trim($matches[1]);
$elem = $matches[2];
$attrlist = $matches[3];
if (!is_array($allowed_html[strtolower($elem)])) {
return '';
}
# They are using a not allowed HTML element
return wp_kses_attr("{$slash}{$elem}", $attrlist, $allowed_html, $allowed_protocols);
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:20,代码来源:kses.php
示例13: process
public function process()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
global $wp_version;
$errorArray = array();
if (!isset($_POST['email']) || empty($_POST['email'])) {
$errorArray[] = 'Email is required';
} elseif (!is_email($_POST['email'])) {
$errorArray[] = 'Invalid from email';
}
if (!isset($_POST['name']) || empty($_POST['name'])) {
$errorArray[] = 'Name is required';
}
if (!isset($_POST['message']) || empty($_POST['message'])) {
$errorArray[] = 'Message is required';
}
if (!isset($_POST['reason']) || empty($_POST['reason'])) {
$errorArray[] = 'Reason is required';
// Tho this should never be blank or empty!
} elseif ($_POST['reason'] != "Bug" && $_POST['reason'] != 'Suggestion' && $_POST['reason'] != 'You guys rock!' && $_POST['reason'] != 'You guys are the suck!' && $_POST['reason'] != 'Moving to CatN') {
$errorArray[] = 'Invalid reason';
// Definetly something a miss here
}
if (empty($errorArray)) {
$fromEmail = get_option('wpsqt_from_email') ? get_option('wpsqt_from_email') : get_option('admin_email');
$headers = 'From: WPSQT Contact Form' . PHP_EOL;
$headers .= 'Reply-To: ' . trim($_POST['name']) . ' <' . $_POST['email'] . '>' . PHP_EOL;
$message = 'From: ' . trim($_POST['name']) . ' <' . $fromEmail . '>' . PHP_EOL;
$message .= 'WPSQT Version: ' . WPSQT_VERSION . PHP_EOL;
$message .= 'PHP Version: ' . PHP_VERSION . PHP_EOL;
$message .= 'WordPress Version: ' . $wp_version . PHP_EOL;
$message .= 'Message: ' . esc_html(wp_kses_stripslashes($_POST['message'])) . PHP_EOL;
if (!wp_mail(WPSQT_CONTACT_EMAIL, 'WPSQT : ' . stripslashes($_POST['reason']), $message, $headers)) {
$errorArray[] = 'Unable to send email, please check wordpress settings';
} else {
$successMessage = 'Email sent! Thank you for reponse';
}
}
}
$this->_pageView = "admin/misc/contact.php";
}
开发者ID:selectSIFISO,项目名称:.comsite,代码行数:41,代码来源:Contact.php
示例14: uz_ace_editor_input
function uz_ace_editor_input($label, $input_name, $input_value, $mode = 'css')
{
$label_string = "label_{$input_name}";
?>
<div class="uz_input">
<label> <?php
echo $label;
?>
</label>
<div id="<?php
echo $mode;
?>
_container">
<div name="<?php
echo $input_name;
?>
" id="<?php
echo $mode;
?>
_editor"></div>
</div>
<textarea id="<?php
echo $mode;
?>
_textarea" name="<?php
echo $input_name;
?>
" style="display: none;"><?php
echo wp_kses_stripslashes($input_value);
?>
</textarea>
</div>
<?php
}
开发者ID:vuzzu,项目名称:utilizer-ui-elements,代码行数:40,代码来源:ace_editor_input.php
示例15: hybrid_get_setting
/**
* Loads the Hybrid theme settings once and allows the input of the specific field the user would
* like to show. Hybrid theme settings are added with 'autoload' set to 'yes', so the settings are
* only loaded once on each page load.
*
* @since 0.7.0
* @access public
* @uses get_option() Gets an option from the database.
* @uses hybrid_get_prefix() Gets the prefix of the theme.
* @global object $hybrid The global Hybrid object.
* @param string $option The specific theme setting the user wants.
* @return mixed $settings[$option] Specific setting asked for.
*/
function hybrid_get_setting($option = '')
{
global $hybrid;
/* If no specific option was requested, return false. */
if (!$option) {
return false;
}
/* If the settings array hasn't been set, call get_option() to get an array of theme settings. */
if (!isset($hybrid->settings)) {
$hybrid->settings = get_option(hybrid_get_prefix() . '_theme_settings', hybrid_get_default_theme_settings());
}
/* If the settings isn't an array or the specific option isn't in the array, return false. */
if (!is_array($hybrid->settings) || empty($hybrid->settings[$option])) {
return false;
}
/* If the specific option is an array, return it. */
if (is_array($hybrid->settings[$option])) {
return $hybrid->settings[$option];
} else {
return wp_kses_stripslashes($hybrid->settings[$option]);
}
}
开发者ID:JunnLearning,项目名称:dk,代码行数:35,代码来源:settings.php
示例16: widget
function widget($args, $instance)
{
extract($args);
$image = $instance['image'];
$url = $instance['url'];
$alt = $instance['alt'];
$code = $instance['code'];
$target = !empty($instance['target']) ? ' target="_blank"' : '';
$nofollow = !empty($instance['nofollow']) ? ' rel="nofollow"' : '';
echo $before_widget;
if ($instance['title']) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
echo '<div class="ad-widget">';
if (!empty($code)) {
echo wp_kses_stripslashes($code);
} else {
echo '<a' . $target . $nofollow . ' href="' . $url . '"><img src="' . $image . '" alt="' . $alt . '" /></a>';
}
echo '</div>';
echo $after_widget;
}
开发者ID:alphadc,项目名称:xiuxing,代码行数:22,代码来源:widget-ad.php
示例17: kses_split
/**
* This is a modified version of the WordPress function wp_kses_split2.
*
* @since 1.4
*
* @param array $match
* @return string Fixed HTML element
*/
private static function kses_split($match)
{
$string = wp_kses_stripslashes($match[0]);
// Encode the ">" character
if (substr($string, 0, 1) != '<') {
return '>';
}
// Do not allow HTML comments
if ('<!--' == substr($string, 0, 4)) {
return '';
}
// It's seriously malformed
if (!preg_match('%^<\\s*(/\\s*)?([a-zA-Z0-9:]+)([^>]*)>?$%', $string, $matches)) {
return '';
}
$slash = trim($matches[1]);
$elem = $matches[2];
//$attrlist = $matches[3];
// They are using a not allowed HTML element
if (!isset(self::$xmlTags[strtolower($elem)])) {
return '';
}
return $slash ? "</{$elem}>" : "<{$elem}>";
}
开发者ID:MarkSpencerTan,项目名称:webdev,代码行数:32,代码来源:sitetree-utilities.class.php
示例18: live_update
/**
* Sends Updated Actions to the List Table View
*
* @todo fix reliability issues with sidebar widgets
*
* @uses gather_updated_items
* @uses generate_row
*
* @param array Response to heartbeat
* @param array Response from heartbeat
*
* @return array Data sent to heartbeat
*/
public static function live_update($response, $data)
{
if (!isset($data['wp-stream-heartbeat-last-id'])) {
return;
}
$last_id = intval($data['wp-stream-heartbeat-last-id']);
$query = $data['wp-stream-heartbeat-query'];
if (empty($query)) {
$query = array();
}
// Decode the query
$query = json_decode(wp_kses_stripslashes($query));
$updated_items = WP_Stream_Dashboard_Widget::gather_updated_items($last_id, $query);
if (!empty($updated_items)) {
ob_start();
foreach ($updated_items as $item) {
self::$list_table->single_row($item);
}
$send = ob_get_clean();
} else {
$send = '';
}
return $send;
}
开发者ID:xwp,项目名称:stream-legacy,代码行数:37,代码来源:live-update.php
示例19: update
function update($new, $old)
{
$instance = $old;
$instance['title'] = strip_tags($new['title']);
$instance['category'] = (int) $new['category'];
$instance['archive'] = (int) $new['archive'];
$instance['recent'] = (int) $new['recent'];
$instance['tag'] = (int) $new['tag'];
$instance['menu'] = (int) $new['menu'];
$instance['text'] = (int) $new['text'];
$instance['showcount'] = (int) $new['showcount'];
$instance['limits'] = (int) $new['limits'];
$instance['category_label'] = wp_kses_stripslashes($new['category_label']);
$instance['archive_label'] = wp_kses_stripslashes($new['archive_label']);
$instance['recent_label'] = wp_kses_stripslashes($new['recent_label']);
$instance['tag_label'] = wp_kses_stripslashes($new['tag_label']);
$instance['menu_label'] = wp_kses_stripslashes($new['menu_label']);
$instance['menu_id'] = $new['menu_id'];
$instance['text_label'] = wp_kses_stripslashes($new['text_label']);
$instance['textcontent'] = wp_kses_stripslashes($new['textcontent']);
$instance['data'] = $new['data'];
$items = array();
parse_str($instance['data'], $items);
if (!empty($items['tab'])) {
$ii = 1;
foreach ($items['tab'] as $item) {
if ($instance[$item]) {
$instance[$item] = $ii;
$ii = $ii + 1;
}
}
}
return $instance;
}
开发者ID:jimdough,项目名称:Roadmaster,代码行数:34,代码来源:widgets.php
示例20: wp_kses_split2
/**
* Callback for wp_kses_split for fixing malformed HTML tags.
*
* This function does a lot of work. It rejects some very malformed things like
* <:::>. It returns an empty string, if the element isn't allowed (look ma, no
* strip_tags()!). Otherwise it splits the tag into an element and an attribute
* list.
*
* After the tag is split into an element and an attribute list, it is run
* through another filter which will remove illegal attributes and once that is
* completed, will be returned.
*
* @access private
* @since 1.0.0
*
* @param string $string Content to filter
* @param array $allowed_html Allowed HTML elements
* @param array $allowed_protocols Allowed protocols to keep
* @return string Fixed HTML element
*/
function wp_kses_split2($string, $allowed_html, $allowed_protocols)
{
$string = wp_kses_stripslashes($string);
if (substr($string, 0, 1) != '<') {
return '>';
}
// It matched a ">" character
if ('<!--' == substr($string, 0, 4)) {
$string = str_replace(array('<!--', '-->'), '', $string);
while ($string != ($newstring = wp_kses($string, $allowed_html, $allowed_protocols))) {
$string = $newstring;
}
if ($string == '') {
return '';
}
// prevent multiple dashes in comments
$string = preg_replace('/--+/', '-', $string);
// prevent three dashes closing a comment
$string = preg_replace('/-$/', '', $string);
return "<!--{$string}-->";
}
// Allow HTML comments
if (!preg_match('%^<\\s*(/\\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) {
return '';
}
// It's seriously malformed
$slash = trim($matches[1]);
$elem = $matches[2];
$attrlist = $matches[3];
if (!is_array($allowed_html)) {
$allowed_html = wp_kses_allowed_html($allowed_html);
}
if (!isset($allowed_html[strtolower($elem)])) {
return '';
}
// They are using a not allowed HTML element
if ($slash != '') {
return "</{$elem}>";
}
// No attributes are allowed for closing elements
return wp_kses_attr($elem, $attrlist, $allowed_html, $allowed_protocols);
}
开发者ID:zoran180,项目名称:wp_szf,代码行数:62,代码来源:kses.php
注:本文中的wp_kses_stripslashes函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论