• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_kses函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_kses函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_kses函数的具体用法?PHP wp_kses怎么用?PHP wp_kses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_kses函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_plugin_version

function get_plugin_version($author)
{
    require_once ABSPATH . '/wp-admin/includes/plugin.php';
    if ($author !== '') {
        $plugin_author = $author;
    } else {
        $plugin_author = '*';
    }
    $plugins = get_plugins();
    $plugins_allowedtags1 = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
    foreach ($plugins as $plugin_file => $plugin_data) {
        $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags1);
        $plugin_data['Title'] = $plugin_data['PluginURI'] ? '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Title'] . '</a>' : $plugin_data['Title'];
        $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags1);
        $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags1);
        $plugin_data['Author'] = empty($plugin_data['Author']) ? '' : ' <cite>' . sprintf(__('%s', 'wp-list-plugins'), $plugin_data['AuthorURI'] ? '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>' : $plugin_data['Author']) . '.</cite>';
        $local_version = $plugin_data['Version'];
        //    $local_version='0.5';
        if (strpos($plugin_data['Author'], $plugin_author) == true || strpos($plugin_data['Name'], 'Rob') == true || $author == '') {
            $var_sHtml .= "<li>{$plugin_data['Title']} (v. {$plugin_data['Version']} ) By {$plugin_data['Author']}.</li>";
            $p_arr = explode("/", $plugin_file);
            $p_file = $p_arr[0];
            compare_versions($p_file, $local_version);
        }
        $var_iPlugInNumber++;
    }
    if (is_admin()) {
        echo $var_sHtml;
    }
    return $var_sHtml;
}
开发者ID:roblandry,项目名称:check-my-version,代码行数:31,代码来源:check-plugin.php


示例2: shortcode

 public function shortcode($atts, $content = null)
 {
     $attributes = shortcode_atts(array('title' => ''), $atts);
     $attributes['title'] = wp_kses($attributes['title'], array());
     $output = sprintf('<div class="st-toggle"><a class="text-primary" href="#">%s</a><div class="st-toggle-content">%s</div></div>', $attributes['title'], do_shortcode($content));
     return $output;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:7,代码来源:toggles.php


示例3: check

 function check($files)
 {
     $result = true;
     /**
      * Extract the theme name from style.css.
      */
     $css = $this->merge_files($files, 'css');
     preg_match('|Theme Name:(.*)$|mi', $css, $theme_name);
     $name = isset($theme_name[1]) ? wp_kses(trim($theme_name[1]), array()) : '';
     /**
      * Check if the theme name exists.
      */
     $this->increment_check_count();
     if (empty($name)) {
         $this->add_error('theme-name', 'The theme name needs to be indicated in style.css.', Basescanner::LEVEL_BLOCKER);
         $result = false;
         // There is no point in continuing of there is no theme name.
         return $result;
     }
     /**
      * List of all the words (case insensitive) that can't be part of the theme name.
      */
     $this->increment_check_count();
     $forbidden_words = array('blog', 'creative', 'css3', 'css 3', 'framework', 'html5', 'html 5', 'pro', 'responsive', 'skin', 'template', 'theme', 'Twenty', 'WordPress', 'WordPress.com', 'WP', 'WP.com');
     foreach ($forbidden_words as $word) {
         if (preg_match('/(\\s|^)' . $word . '(\\s|$)/i', $name)) {
             $this->add_error('theme-name', 'Found the word <em>' . esc_html($word) . '</em> in the theme name. This word is not allowed, please remove it.', Basescanner::LEVEL_BLOCKER);
             $result = false;
         }
     }
     return $result;
 }
开发者ID:grappler,项目名称:vip-scanner,代码行数:32,代码来源:ThemeNameCheck.php


示例4: after_section

    /**
     * HTML to display after the section.
     *
     * @return string
     * @access public
     */
    public function after_section()
    {
        ?>
			</div>
			<div class="apple-news-settings-preview">
				<?php 
        // Build sample content
        $settings = new Admin_Apple_Settings();
        $title = sprintf('<h1 class="apple-news-title apple-news-component">%s</h1>', __('Sample Article', 'apple-news'));
        $cover = sprintf('<div class="apple-news-cover">%s</div>', __('Cover', 'apple-news'));
        // Build the byline
        $author = __('John Doe', 'apple-news');
        $date = date('M j, Y g:i A');
        $export = new Apple_Actions\Index\Export($settings->fetch_settings());
        $byline = sprintf('<div class="apple-news-byline apple-news-component">%s</div>', $export->format_byline(null, $author, $date));
        // Get the order of the top components
        $component_order = self::get_value('meta_component_order');
        foreach ($component_order as $component) {
            echo wp_kses(${$component}, self::$allowed_html);
        }
        ?>
				<div class="apple-news-component">
				<p><span class="apple-news-dropcap">L</span>orem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sagittis, <a href="#">augue vitae iaculis euismod</a>, libero nulla pellentesque quam, non venenatis massa odio id dolor.</p>
				<div class="apple-news-pull-quote">Lorem ipsum dolor sit amet.</div>
				<p>Praesent eget odio vel sapien scelerisque euismod. Phasellus eros sapien, rutrum ac nibh nec, tristique commodo neque.</p>
				<h2>Quisque efficitur</h2>
				<p>Quisque efficitur sit amet ex et venenatis. Morbi nisi nisi, ornare id iaculis eget, pulvinar ac dolor.</p>
				<p>In eu la	cus porttitor, pellentesque diam et, tristique elit. Mauris justo odio, efficitur sit amet aliquet id, aliquam placerat turpis.</p>
				</div>
			</div>
		</div>
		<?php 
    }
开发者ID:alleyinteractive,项目名称:apple-news,代码行数:39,代码来源:class-admin-apple-settings-section-formatting.php


示例5: wp_stream_reports_selector

function wp_stream_reports_selector($data_types, $args, $class)
{
    $options = array();
    foreach ($data_types as $key => $item) {
        $selected = false;
        if (isset($item['connector']) && $item['connector'] == $args['connector_id'] && isset($item['context']) && $item['context'] == null) {
            $selected = true;
        } else {
            if (isset($item['action']) && $item['action'] == $args['action_id']) {
                $selected = true;
            }
        }
        $option_args = array('value' => $key, 'label' => isset($item['label']) ? $item['label'] : null, 'selected' => selected($selected, true, false), 'disabled' => isset($item['disabled']) ? $item['disabled'] : null, 'class' => isset($item['children']) ? 'level-1' : null, 'connector' => isset($item['connector']) ? $item['connector'] : null, 'context' => isset($item['context']) ? $item['context'] : null, 'action' => isset($item['action']) ? $item['action'] : null);
        $options[] = wp_stream_reports_filter_option($option_args);
        if (isset($item['children'])) {
            foreach ($item['children'] as $child_value => $child_item) {
                $selected = false;
                if (isset($child_item['connector']) && $child_item['connector'] == $args['connector_id'] && isset($child_item['context']) && $child_item['context'] == $args['context_id']) {
                    $selected = true;
                }
                $option_args = array('value' => $child_value, 'label' => isset($child_item['label']) ? $child_item['label'] : null, 'selected' => selected($selected, true, false), 'disabled' => isset($child_item['disabled']) ? $child_item['disabled'] : null, 'class' => 'level-2', 'connector' => isset($child_item['connector']) ? $child_item['connector'] : null, 'context' => isset($child_item['context']) ? $child_item['context'] : null, 'action' => isset($child_item['action']) ? $child_item['action'] : null);
                $options[] = wp_stream_reports_filter_option($option_args);
            }
        }
    }
    $allowed_html = array('option' => array('value' => array(), 'selected' => array(), 'disabled' => array(), 'class' => array(), 'data-connector' => array(), 'data-context' => array(), 'data-action' => array()));
    printf('<select class="%s">%s</select>', esc_attr($class), wp_kses(implode('', $options), $allowed_html));
}
开发者ID:johnleesw,项目名称:mustardseedwp,代码行数:28,代码来源:template-tags.php


示例6: archives_shortcode

function archives_shortcode($attr)
{
    if (is_feed()) {
        return '[archives]';
    }
    global $allowedposttags;
    $default_atts = array('type' => 'postbypost', 'limit' => '', 'format' => 'html', 'showcount' => false, 'before' => '', 'after' => '', 'order' => 'desc');
    extract(shortcode_atts($default_atts, $attr));
    if (!in_array($type, array('yearly', 'monthly', 'daily', 'weekly', 'postbypost'))) {
        $type = 'postbypost';
    }
    if (!in_array($format, array('html', 'option', 'custom'))) {
        $format = 'html';
    }
    if ('' != $limit) {
        $limit = (int) $limit;
    }
    $showcount = (bool) $showcount;
    $before = wp_kses($before, $allowedposttags);
    $after = wp_kses($after, $allowedposttags);
    // Get the archives
    $archives = wp_get_archives('type=' . $type . '&limit=' . $limit . '&format=' . $format . '&echo=0&show_post_count=' . $showcount . '&before=' . $before . '&after=' . $after);
    if ('asc' == $order) {
        $archives = implode("\n", array_reverse(explode("\n", $archives)));
    }
    // Check to see if there are any archives
    if (empty($archives)) {
        $archives = '<p>' . __('Your blog does not currently have any published posts.', 'jetpack') . '</p>';
    } elseif ('option' == $format) {
        $archives = "<select name='archive-dropdown' onchange='document.location.href=this.options[this.selectedIndex].value;'><option value='" . get_permalink() . "'>--</option>" . $archives . "</select>";
    } elseif ('html' == $format) {
        $archives = '<ul>' . $archives . '</ul>';
    }
    return $archives;
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:35,代码来源:archives.php


示例7: flat_paging_nav

function flat_paging_nav()
{
    // Don't print empty markup if there's only one page.
    if ($GLOBALS['wp_query']->max_num_pages < 2) {
        return;
    }
    $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
    $pagenum_link = html_entity_decode(get_pagenum_link());
    $query_args = array();
    $url_parts = explode('?', $pagenum_link);
    if (isset($url_parts[1])) {
        wp_parse_str($url_parts[1], $query_args);
    }
    $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
    $pagenum_link = trailingslashit($pagenum_link) . '%_%';
    $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
    $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
    // Set up paginated links.
    $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 4, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-chevron-left"></i>', 'flat'), 'next_text' => __('<i class="fa fa-chevron-right"></i>', 'flat')));
    $allowed_html = array('a' => array('href' => array(), 'class' => array()), 'span' => array('class' => array()), 'i' => array('class' => array()));
    if ($links) {
        ?>
		<nav class="navigation paging-navigation" role="navigation">
			<div class="nav-links">
				<?php 
        echo wp_kses($links, $allowed_html);
        ?>
			</div>
		</nav>
	<?php 
    }
}
开发者ID:pivaker,项目名称:driverschool,代码行数:32,代码来源:template-tags.php


示例8: filter_source

/**
 * Filter the source for foolish strings.
 *
 * @param string $source The custom css source code from settings.
 *
 * @return string
 */
function filter_source($source)
{
    $source = wp_kses($source, array('\'', '\\"'));
    // Remove blank lines from string.
    $source = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $source);
    return $source;
}
开发者ID:bueltge,项目名称:custom-css,代码行数:14,代码来源:core.php


示例9: inline_comments_add_comment

/**
 * Inserts a comment for the current post if the user is logged in.
 *
 * @since 0.1-alpha
 * @uses check_ajax_referer()
 * @uses is_user_logged_in()
 * @uses wp_insert_comment()
 * @uses wp_get_current_user()
 * @uses current_time()
 * @uses wp_kses()
 * @uses get_option()
 */
function inline_comments_add_comment()
{
    check_ajax_referer('inline_comments_nonce', 'security');
    $comment = trim(wp_kses($_POST['comment'], array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'blockquote' => array(), 'code' => array())));
    if (empty($comment)) {
        die;
    }
    if (get_option('comment_registration') == 1 && !is_user_logged_in()) {
        die;
    }
    $data = array('comment_post_ID' => (int) $_POST['post_id'], 'comment_content' => $comment, 'comment_type' => '', 'comment_parent' => 0, 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => $_SERVER['HTTP_USER_AGENT'], 'comment_date' => current_time('mysql'), 'comment_approved' => 1);
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        $author_email = $current_user->user_email;
        $author_url = $current_user->user_url;
        $author_name = $current_user->user_nicename;
        $data['user_id'] = $current_user->ID;
    } else {
        $author_email = empty($_POST['user_email']) ? null : esc_attr($_POST['user_email']);
        $author_url = empty($_POST['user_url']) ? null : esc_url($_POST['user_url'], array('http', 'https'));
        $author_name = empty($_POST['user_name']) ? null : esc_attr($_POST['user_name']);
    }
    $data['comment_author'] = $author_name;
    $data['comment_author_email'] = $author_email;
    $data['comment_author_url'] = $author_url;
    // ck - catch the new comment id for updating comment meta
    $comment_id = wp_insert_comment($data);
    // ck - now add the para-id to the comment meta
    add_comment_meta($comment_id, 'para_id', $_POST['para_id']);
    die;
}
开发者ID:hdmade,项目名称:paragraph_commenting,代码行数:43,代码来源:template-tags.php


示例10: intercept_post_id

 /**
  * Get data before saving to CMB.
  */
 public function intercept_post_id()
 {
     // Check for $_POST data
     if (empty($_POST)) {
         return false;
     }
     // Check nonce
     if (!(isset($_POST['submit-cmb'], $_POST['wp_meta_box_nonce']) && wp_verify_nonce($_POST['wp_meta_box_nonce'], cmb_Meta_Box::nonce()))) {
         return;
     }
     // Setup and sanitize data
     if (isset($_POST[$this->prefix . 'place_name'])) {
         $this->new_submission = wp_insert_post(array('post_title' => sanitize_text_field($_POST[$this->prefix . 'place_name']), 'post_author' => get_current_user_id(), 'post_status' => 'draft', 'post_type' => 'accommodations', 'post_content' => wp_kses($_POST[$this->prefix . 'place_notes'], '<b><strong><i><em><h1><h2><h3><h4><h5><h6><pre><code><span>')), true);
         // If no errors, save the data into a new post draft
         if (!is_wp_error($this->new_submission)) {
             $address = sanitize_text_field($_POST['address']);
             $lat = sanitize_text_field($_POST['lat']);
             $lng = sanitize_text_field($_POST['lng']);
             $formatted_address = sanitize_text_field($_POST['formatted_address']);
             // Update the meta field in the database.
             update_post_meta($this->new_submission, 'address', $address);
             update_post_meta($this->new_submission, 'lat', $lat);
             update_post_meta($this->new_submission, 'lng', $lng);
             update_post_meta($this->new_submission, 'formatted_address', $formatted_address);
             update_post_meta($this->new_submission, 'place_image_id', $_POST['place_image_id']);
             //update post parent in place_image_id
             $image = array('ID' => get_post_meta($this->new_submission, 'place_image_id', 1), 'post_parent' => $this->new_submission);
             wp_update_post($image);
             set_post_thumbnail($this->new_submission, get_post_meta($this->new_submission, 'place_image_id', 1));
             return $this->new_submission;
         }
     }
     return false;
 }
开发者ID:bulini,项目名称:booking-wp,代码行数:37,代码来源:accommodation.php


示例11: sanitize_css

 /**
  * Sanitize and tidy a string of CSS
  *
  * @since 1.1.0
  *
  * @uses CSSTidy
  *
  * @param string $css CSS code
  * @return string Sanitized and tidied CSS code
  */
 function sanitize_css($css)
 {
     $csstidy = TablePress::load_class('csstidy', 'class.csstidy.php', 'libraries/csstidy');
     // Sanitization and not just tidying for users without enough privileges
     if (!current_user_can('unfiltered_html')) {
         $csstidy->optimise = new csstidy_custom_sanitize($csstidy);
         $css = str_replace('<=', '&lt;=', $css);
         // Let "arrows" survive, otherwise this might be recognized as the beginning of an HTML tag and removed with other stuff behind it
         $css = wp_kses($css, 'strip');
         // remove all HTML tags
         $css = str_replace('&gt;', '>', $css);
         // KSES replaces single ">" with "&gt;", but ">" is valid in CSS selectors
         $css = strip_tags($css);
         // strip_tags again, because of the just added ">" (KSES for a second time would again bring the ">" problem)
     }
     $csstidy->set_cfg('remove_bslash', false);
     $csstidy->set_cfg('compress_colors', false);
     $csstidy->set_cfg('compress_font-weight', false);
     $csstidy->set_cfg('lowercase_s', false);
     $csstidy->set_cfg('optimise_shorthands', false);
     $csstidy->set_cfg('remove_last_;', false);
     $csstidy->set_cfg('case_properties', false);
     $csstidy->set_cfg('sort_properties', false);
     $csstidy->set_cfg('sort_selectors', false);
     $csstidy->set_cfg('discard_invalid_selectors', false);
     $csstidy->set_cfg('discard_invalid_properties', true);
     $csstidy->set_cfg('merge_selectors', false);
     $csstidy->set_cfg('css_level', 'CSS3.0');
     $csstidy->set_cfg('preserve_css', true);
     $csstidy->set_cfg('timestamp', false);
     $csstidy->set_cfg('template', dirname(TABLEPRESS__FILE__) . '/libraries/csstidy/tablepress-standard.tpl');
     $csstidy->parse($css);
     return $csstidy->print->plain();
 }
开发者ID:heyjones,项目名称:crossfitpurpose,代码行数:44,代码来源:class-css.php


示例12: widget

    function widget($args, $instance)
    {
        extract($args);
        $instance = wp_parse_args((array) $instance, array('title' => '', 'text' => '', 'id' => '', 'input_text' => '', 'button_text' => ''));
        echo $before_widget . '<div class="enews">';
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
        }
        global $_genesis_formatting_allowedtags;
        echo wpautop(wp_kses($instance['text'], $_genesis_formatting_allowedtags));
        if (!empty($instance['id'])) {
            ?>
			<form id="subscribe" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php 
            echo esc_js($instance['id']);
            ?>
', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"><input type="text" value="<?php 
            echo esc_attr($instance['input_text']);
            ?>
" id="subbox" onfocus="if (this.value == '<?php 
            echo esc_js($instance['input_text']);
            ?>
') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php 
            echo esc_js($instance['input_text']);
            ?>
';}" name="email"/><input type="hidden" value="<?php 
            echo esc_attr($instance['id']);
            ?>
" name="uri"/><input type="hidden" name="loc" value="en_US"/><input type="submit" value="<?php 
            echo esc_attr($instance['button_text']);
            ?>
" id="subbutton" /></form>
			<?php 
        }
        echo '</div>' . $after_widget;
    }
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:35,代码来源:enews-widget.php


示例13: dwqa_pre_content

function dwqa_pre_content($content)
{
    global $post_submit_filter;
    $content = htmlspecialchars_decode($content);
    $content = wp_kses(dwqa_pre_content_filter($content), $post_submit_filter);
    return $content;
}
开发者ID:christianlee13,项目名称:dw-question-answer,代码行数:7,代码来源:import-tool-for-nex.php


示例14: __construct

 /**
  * Class constructor
  *
  * @since 2.0.5
  * @author jkudish
  * @param string $id the field id
  * @param array $field the field settings
  * @param null|mixed $value the field's current value
  * @return void
  */
 public function __construct($id, $field, $value = null)
 {
     // setup the defaults
     $this->defaults = array('type' => 'html', 'name' => $id, 'attributes' => array(), 'class' => null, 'label' => null, 'tooltip' => null, 'size' => 'medium', 'html' => null, 'error' => false, 'value' => $value, 'options' => null, 'conditional' => true, 'display_callback' => null, 'if_empty' => null, 'can_be_empty' => false, 'clear_after' => true);
     // a list of valid field types, to prevent screwy behaviour
     $this->valid_field_types = array('heading', 'html', 'text', 'textarea', 'wysiwyg', 'radio', 'checkbox_bool', 'checkbox_list', 'dropdown', 'dropdown_chosen', 'dropdown_select2', 'license_key');
     $this->valid_field_types = apply_filters('tribe_valid_field_types', $this->valid_field_types);
     // parse args with defaults and extract them
     $args = wp_parse_args($field, $this->defaults);
     extract($args);
     // sanitize the values just to be safe
     $id = esc_attr($id);
     $type = esc_attr($type);
     $name = esc_attr($name);
     $class = sanitize_html_class($class);
     $label = wp_kses($label, array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 'img' => array('title' => array(), 'src' => array(), 'alt' => array())));
     $tooltip = wp_kses($tooltip, array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 'img' => array('title' => array(), 'src' => array(), 'alt' => array()), 'code' => array('span' => array()), 'span' => array()));
     $size = esc_attr($size);
     $html = $html;
     $error = (bool) $error;
     $value = $value;
     $conditional = $conditional;
     $display_callback = $display_callback;
     $clear_after = (bool) $clear_after;
     // set the ID
     $this->id = apply_filters('tribe_field_id', $id);
     // set each instance variable and filter
     foreach ($this->defaults as $key => $value) {
         $this->{$key} = apply_filters('tribe_field_' . $key, ${$key}, $this->id);
     }
     // epicness
     $this->doField();
 }
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:43,代码来源:tribe-field.class.php


示例15: check

 function check($files)
 {
     $result = true;
     $php = $this->merge_files($files, 'php');
     $php_files = $this->filter_files($files, 'php');
     /**
      * Comments listing.
      */
     $this->increment_check_count();
     if (false === strpos($php, 'wp_list_comments')) {
         $this->add_error('comments-wp-list-comments', "The theme doesn't have a call to <code>wp_list_comments()</code> in it.", Basescanner::LEVEL_BLOCKER);
         $result = false;
     }
     /**
      * Comments pagination.
      */
     $this->increment_check_count();
     if (false === strpos($php, 'paginate_comments_links') && (false === strpos($php, 'previous_comments_link') || false === strpos($php, 'next_comments_link'))) {
         $this->add_error('comments', "The theme doesn't have comment pagination code in it. Use <code>paginate_comments_links()</code> or <code>next_comments_link()</code> and <code>previous_comments_link()</code> to add comment pagination.", Basescanner::LEVEL_BLOCKER);
         $result = false;
     }
     /**
      * Check whether the comment form is filtered.
      */
     foreach ($php_files as $file_path => $file_content) {
         if (preg_match('/add_filter\\(\\s*[\'"]comment_form_defaults[\'"]/', $file_content)) {
             $this->add_error('filtering_comment_form_defaults', wp_kses(__("WordPress.com has it's own commenting experience, themes should not filter the comment form defaults via <code>add_filter( 'comment_form_defaults', [...] )</code>."), array('code' => array())), Basescanner::LEVEL_WARNING, $this->get_filename($file_path));
             $result = false;
         }
     }
     return $result;
 }
开发者ID:Zackio,项目名称:vip-scanner,代码行数:32,代码来源:CommentsCheck.php


示例16: prepare_for_set

 /**
  * removes all tags which a WP Post wouldn't allow in its content normally
  * @param string $value
  * @return string
  */
 function prepare_for_set($value)
 {
     if (!current_user_can('unfiltered_html')) {
         $value = wp_kses("{$value}", wp_kses_allowed_html('post'));
     }
     return parent::prepare_for_set($value);
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:12,代码来源:EE_Post_Content_Field.php


示例17: feedback

 /**
  * @param string|array|WP_Error $data
  */
 public function feedback($data)
 {
     if (is_wp_error($data)) {
         $string = $data->get_error_message();
     } elseif (is_array($data)) {
         return;
     } else {
         $string = $data;
     }
     if (!empty($this->upgrader->strings[$string])) {
         $string = $this->upgrader->strings[$string];
     }
     if (strpos($string, '%') !== false) {
         $args = func_get_args();
         $args = array_splice($args, 1);
         if (!empty($args)) {
             $string = vsprintf($string, $args);
         }
     }
     $string = trim($string);
     // Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
     $string = wp_kses($string, array('a' => array('href' => true), 'br' => true, 'em' => true, 'strong' => true));
     if (empty($string)) {
         return;
     }
     $this->messages[] = $string;
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:30,代码来源:class-automatic-upgrader-skin.php


示例18: update

 /**
  * Update a particular instance.
  *
  * 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.
  *
  * @param array $new_instance New settings for this instance as input by the user via form()
  * @param array $old_instance Old settings for this instance
  * @return array Settings to save or bool false to cancel saving
  */
 function update($new_instance, $old_instance)
 {
     $new_instance['title'] = strip_tags($new_instance['title']);
     $new_instance['bio_text'] = wp_kses($new_instance['bio_text'], genesis_formatting_allowedtags());
     $new_instance['page_link_text'] = strip_tags($new_instance['page_link_text']);
     return $new_instance;
 }
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:18,代码来源:user-profile-widget.php


示例19: widget

    public function widget($args, $instance)
    {
        echo wp_kses_post($args['before_widget']);
        if (!empty($instance['title'])) {
            echo wp_kses_post($args['before_title']) . esc_html($instance['title']) . wp_kses_post($args['after_title']);
        }
        $barcelona_image = is_numeric($instance['image']) ? barcelona_get_thumbnail_url('barcelona-sq', $instance['image'], true, true) : '';
        ?>
		<div class="about-me">

			<?php 
        if (!empty($barcelona_image)) {
            echo '<p class="about-image"><img src="' . esc_url($barcelona_image[0]) . '" alt="' . esc_attr($instance['name']) . '" /></p>';
        }
        if (!empty($instance['name'])) {
            echo '<h2 class="about-name">' . esc_html($instance['name']) . '</h2>';
        }
        if (!empty($instance['job_title'])) {
            echo '<h4 class="about-job-title">' . esc_html($instance['job_title']) . '</h4>';
        }
        ?>
			<p class="description">
				<?php 
        echo wp_kses(nl2br($instance['description']), array('br' => array()));
        ?>
			</p>

		</div>
		<?php 
        echo wp_kses_post($args['after_widget']);
    }
开发者ID:yalmaa,项目名称:little-magazine,代码行数:31,代码来源:barcelona-about-me.php


示例20: widget

        /**
         * Front-end display of widget.
         * @see WP_Widget::widget()
         * @param array $args     Widget arguments.
         * @param array $instance Saved values from database.
         */
        public function widget($args, $instance)
        {
            extract($args);
            extract($instance);
            global $allowed_html_tags;
            $email = sanitize_email($email);
            $email = is_email($email);
            $title = apply_filters('widget_title', $title);
            echo $before_widget;
            ?>
            <?php 
            echo $title ? $before_title . $title . $after_title : false;
            ?>
            <section class="contact-option-single">
                <address>
                    <p><?php 
            echo $address ? wp_kses($address, $allowed_html_tags) : '';
            ?>
</p>
                </address>
                <ul class="contact-options">
                    <?php 
            echo $phone ? '<li class="phone"><span>' . __('Phone: ', 'majestic-widgets') . '</span>' . esc_attr($phone) . '</li>' : '';
            echo $fax ? '<li class="fax"><span>' . __('Fax: ', 'majestic-widgets') . '</span>' . esc_attr($fax) . '</li>' : '';
            echo $email ? '<li class="email"><span>' . __('Email: ', 'majestic-widgets') . '</span><a href="mailto:' . $email . '">' . $email . '</a></li>' : '';
            ?>
                </ul>
            </section>
            <?php 
            echo $after_widget;
        }
开发者ID:hassanrazmy,项目名称:Majestic-Widgets,代码行数:37,代码来源:address-widget.php



注:本文中的wp_kses函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_kses_allowed_html函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_json_encode函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap