当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_kses_allowed_html函数代码示例

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


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

示例1: bp_groups_filter_kses

/**
 * Filter output of Group Description through WordPress's KSES API.
 *
 * @since BuddyPress (1.1.0)
 *
 * @param string $content
 * @return string
 */
function bp_groups_filter_kses($content = '')
{
    /**
     * Note that we don't immediately bail if $content is empty. This is because
     * WordPress's KSES API calls several other filters that might be relevant
     * to someone's workflow (like `pre_kses`)
     */
    // Get allowed tags using core WordPress API allowing third party plugins
    // to target the specific `buddypress-groups` context.
    $allowed_tags = wp_kses_allowed_html('buddypress-groups');
    // Add our own tags allowed in group descriptions
    $allowed_tags['a']['class'] = array();
    $allowed_tags['img'] = array();
    $allowed_tags['img']['src'] = array();
    $allowed_tags['img']['alt'] = array();
    $allowed_tags['img']['class'] = array();
    $allowed_tags['img']['width'] = array();
    $allowed_tags['img']['height'] = array();
    $allowed_tags['img']['class'] = array();
    $allowed_tags['img']['id'] = array();
    $allowed_tags['code'] = array();
    /**
     * Filter HTML elements allowed for a given context.
     *
     * @since BuddyPress (1.1.0)
     *
     * @param string $allowed_tags Allowed tags, attributes, and/or entities.
     */
    $tags = apply_filters('bp_groups_filter_kses', $allowed_tags);
    // Return KSES'ed content, allowing the above tags
    return wp_kses($content, $tags);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:40,代码来源:bp-groups-filters.php

示例2: __construct

 /**
  * The enhanced default constructor, ends up setting all parameters via the set_ functions
  *  
  * @param string $title (optional) The title of the breadcrumb
  * @param string $template (optional) The html template for the breadcrumb
  * @param string $type (optional) The breadcrumb type
  * @param string $url (optional) The url the breadcrumb links to
  */
 public function __construct($title = '', $template = '', array $type = array(), $url = NULL, $id = NULL)
 {
     //Filter allowed_html array to allow others to add acceptable tags
     $this->allowed_html = apply_filters('bcn_allowed_html', wp_kses_allowed_html('post'));
     //The breadcrumb type
     $this->type = $type;
     //Set the resource id
     $this->set_id($id);
     //Set the title
     $this->set_title($title);
     //Assign the breadcrumb template, need strict comparison as we only want to enter if we had a blank URL, not NULL URL
     if ($template == NULL || $url === '') {
         if ($url == NULL || $url === '') {
             $template = __('<span typeof="v:Breadcrumb"><span property="v:title">%htitle%</span></span>', 'breadcrumb-navxt');
         } else {
             $template = __('<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" title="Go to %title%." href="%link%" class="%type%">%htitle%</a></span>', 'breadcrumb-navxt');
         }
     }
     //Loose comparison, evaluates to true if URL is '' or NULL
     if ($url == NULL) {
         $this->template_no_anchor = wp_kses(apply_filters('bcn_breadcrumb_template_no_anchor', $template, $this->type, $this->id), $this->allowed_html);
     } else {
         $this->set_template($template);
     }
     //Always NULL if unlinked
     $this->set_url($url);
 }
开发者ID:pwsclau,项目名称:kurastar_dev,代码行数:35,代码来源:class.bcn_breadcrumb.php

示例3: __construct

 /**
  * The enhanced default constructor, ends up setting all parameters via the set_ functions
  *  
  * @param string $title (optional) The title of the breadcrumb
  * @param string $template (optional) The html template for the breadcrumb
  * @param string $type (optional) The breadcrumb type
  * @param string $url (optional) The url the breadcrumb links to
  */
 public function __construct($title = '', $template = '', array $type = array(), $url = '', $id = NULL)
 {
     //Filter allowed_html array to allow others to add acceptable tags
     $this->allowed_html = apply_filters('bcn_allowed_html', wp_kses_allowed_html('post'));
     //The breadcrumb type
     $this->type = $type;
     //Set the resource id
     $this->set_id($id);
     //Set the title
     $this->set_title($title);
     //Set the default anchorless templates value
     $this->template_no_anchor = bcn_breadcrumb::default_template_no_anchor;
     //If we didn't get a good template, use a default template
     if ($template == NULL) {
         $this->set_template(bcn_breadcrumb::get_default_template());
     } else {
         //Loose comparison, evaluates to true if URL is '' or NULL
         if ($url == NULL) {
             $this->template_no_anchor = wp_kses(apply_filters('bcn_breadcrumb_template_no_anchor', $template, $this->type, $this->id), $this->allowed_html);
             $this->set_template(bcn_breadcrumb::get_default_template());
         } else {
             $this->set_template($template);
         }
     }
     //Always NULL if unlinked
     $this->set_url($url);
 }
开发者ID:KJaddoe,项目名称:CSCMRA-Project,代码行数:35,代码来源:class.bcn_breadcrumb.php

示例4: formatData

 private function formatData($data, $section)
 {
     if (!isset($data['elements'])) {
         $data['elements'] = array();
     }
     $data = wp_parse_args($data, $section->getDefaults());
     // Get around id being a reserved keyword. This way we can still use it in render methods for elements
     if (isset($data['custom_id'])) {
         $data['id'] = $data['custom_id'];
     }
     // Format data before rendering
     foreach ($data as $key => $item) {
         if (is_array($item) && count($item) == 5 && ($item[4] == 'linked' || $item[4] == 'unlinked')) {
             $data[$key . '_linked'] = array_pop($item);
             $data[$key] = array_map('esc_html', array($item[0], $item[1], $item[2], $item[3]));
             continue;
         }
         // Convert boolean to string
         if ($item === true) {
             $data[$key] = 'true';
             continue;
         }
         if ($item === false) {
             $data[$key] = 'false';
             continue;
         }
         if (is_string($item) && !current_user_can('unfiltered_html')) {
             $data[$key] = wp_kses($item, wp_kses_allowed_html('post'));
             continue;
         }
     }
     return $data;
 }
开发者ID:datracka,项目名称:datalook.io,代码行数:33,代码来源:class-setting-sections-manager.php

示例5: sgPopupDataSanitize

 public static function sgPopupDataSanitize($sgPopupData)
 {
     $allowedHtmltags = wp_kses_allowed_html('post');
     $allowedHtmltags['input'] = array('name' => true, 'class' => true, 'id' => true, 'placeholder' => true, 'title' => true, 'value' => true, 'type' => true);
     $allowedHtmltags['iframe'] = array('name' => true, 'class' => true, 'id' => true, 'title' => true, 'src' => true, 'height' => true, 'width' => true);
     return wp_kses($sgPopupData, $allowedHtmltags);
 }
开发者ID:ronal2do,项目名称:openshift-wordpress-developer-quickstart,代码行数:7,代码来源:sg_popup_pro.php

示例6: bcn_breadcrumb

 /**
  * The enhanced default constructor, ends up setting all parameters via the set_ functions
  *  
  * @param string $title (optional) The title of the breadcrumb
  * @param string $template (optional) The html template for the breadcrumb
  * @param string $type (optional) The breadcrumb type
  * @param string $url (optional) The url the breadcrumb links to
  */
 public function bcn_breadcrumb($title = '', $template = '', $type = '', $url = NULL, $id = NULL)
 {
     //Filter allowed_html array to allow others to add acceptable tags
     $this->allowed_html = apply_filters('bcn_allowed_html', wp_kses_allowed_html('post'));
     //The breadcrumb type
     $this->type = $type;
     //Set the resource id
     $this->set_id($id);
     //Set the title
     $this->set_title($title);
     //Assign the breadcrumb template
     if ($template == NULL) {
         if ($url == NULL) {
             $template = $this->template = __('%htitle%', 'breadcrumb-navxt');
         } else {
             $template = __('<a title="Go to %ftitle%." href="%link%" class="%type%">%htitle%</a>', 'breadcrumb-navxt');
         }
     }
     if ($url == NULL) {
         $this->template_no_anchor = wp_kses($template, $this->allowed_html);
     } else {
         $this->set_template($template);
     }
     //Always NULL if unlinked
     $this->set_url($url);
 }
开发者ID:GarryVeles,项目名称:Artibaltika,代码行数:34,代码来源:breadcrumb_navxt_class.php

示例7: value

 /**
  * Sanitize editor
  *
  * @param mixed $new
  * @param mixed $old
  * @param int   $post_id
  * @param array $field
  *
  * @return string
  */
 static function value($new, $old, $post_id, $field)
 {
     $prefix = 'wppf-';
     $the_field_id = $prefix . $field['id'];
     $allowed_html = apply_filters('wppf_editor_field_allowed_html', wp_kses_allowed_html('post'));
     return wp_kses($_POST[$the_field_id], $allowed_html);
 }
开发者ID:devd123,项目名称:wpaam,代码行数:17,代码来源:editor.php

示例8: create_feedback

 public function create_feedback($params)
 {
     global $un_settings;
     if (isset($params['title']) && $params['title']) {
         $title = $params['title'];
     }
     $content = $params['description'];
     if (empty($params['title'])) {
         $title = substr($content, 0, 150) . (strlen($content) < 150 ? '' : "…");
     }
     $id = wp_insert_post(array('post_type' => FEEDBACK, 'post_title' => wp_kses(apply_filters('un_feedback_title', $title, $params), wp_kses_allowed_html()), 'post_content' => wp_kses(apply_filters('un_feedback_content', $content, $params), wp_kses_allowed_html()), 'post_status' => un_get_option(UN_PUBLISH_DIRECTLY) ? 'publish' : 'pending', 'post_author' => 0));
     $email = isset($params['email']) ? trim($params['email']) : '';
     if ($email) {
         add_post_meta($id, '_email', $email);
     }
     if (is_user_logged_in()) {
         add_post_meta($id, '_author', get_current_user_id());
     }
     if (isset($params['name']) && trim($params['name'])) {
         add_post_meta($id, '_name', wp_kses(trim($params['name']), wp_kses_allowed_html()));
     }
     wp_set_post_terms($id, $params['type'], FEEDBACK_TYPE);
     do_action('un_feedback_created', $id, $params);
     $this->send_admin_message($id, $params);
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:25,代码来源:model.php

示例9: __construct

 /**
  * The enhanced default constructor, ends up setting all parameters via the set_ functions
  *  
  * @param string $title (optional) The title of the breadcrumb
  * @param string $template (optional) The html template for the breadcrumb
  * @param string $type (optional) The breadcrumb type
  * @param string $url (optional) The url the breadcrumb links to
  */
 public function __construct($title = '', $template = '', $type = '', $url = NULL, $id = NULL)
 {
     //Filter allowed_html array to allow others to add acceptable tags
     $this->allowed_html = apply_filters('bcn_allowed_html', wp_kses_allowed_html('post'));
     //The breadcrumb type
     $this->type = $type;
     //Set the resource id
     $this->set_id($id);
     //Set the title
     $this->set_title($title);
     //Assign the breadcrumb template
     if ($template == NULL) {
         if ($url == NULL) {
             $template = __('<span typeof="v:Breadcrumb"><span property="v:title">%htitle%</span></span>', 'breadcrumb-navxt');
         } else {
             $template = __('<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" title="Go to %title%." href="%link%" class="%type%">%htitle%</a></span>', 'breadcrumb-navxt');
         }
     }
     if ($url == NULL) {
         $this->template_no_anchor = wp_kses(apply_filters('bcn_breadcrumb_template_no_anchor', $template, $this->type, $this->id), $this->allowed_html);
     } else {
         $this->set_template($template);
     }
     //Always NULL if unlinked
     $this->set_url($url);
 }
开发者ID:crazyyy,项目名称:octagram,代码行数:34,代码来源:class.bcn_breadcrumb.php

示例10: 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

示例11: carbon_pagination

/**
 * A lazy way to build, configure and display a new pagination.
 *
 * @param string $pagination The pagination type, can be one of the following:
 *    - Posts
 *    - Post
 *    - Comments
 *    - Custom
 * @param array $args Configuration options to modify the pagination settings.
 * @param bool $echo Whether to display or return the output. True will display, false will return.
 */
function carbon_pagination($pagination, $args = array(), $echo = true)
{
    $output = Carbon_Pagination_Presenter::display($pagination, $args, false);
    if (!$echo) {
        return $output;
    }
    echo wp_kses($output, wp_kses_allowed_html('post'));
}
开发者ID:2createstudio,项目名称:carbon-pagination,代码行数:19,代码来源:functions.php

示例12: sanitize_settings

 public function sanitize_settings()
 {
     parent::sanitize_settings();
     if (is_multisite() || !current_user_can('manage_options')) {
         $allowed_tags = wp_kses_allowed_html('post');
         $this->content = wp_kses($this->content, $allowed_tags);
     }
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:8,代码来源:class-gf-field-html.php

示例13: phn_sanitize_content

 /**
  * Allow <input> and <script> tags
  *
  */
 function phn_sanitize_content($content)
 {
     $wp_allowed_html = wp_kses_allowed_html('post');
     $custom_allowed_html = array('input' => array('name' => array(), 'id' => array(), 'value' => array(), 'class' => array(), 'type' => array(), 'onblur' => array(), 'onfocus' => array()), 'script' => array('type' => array(), 'src' => array()));
     $allowed_html = $wp_allowed_html + $custom_allowed_html;
     $sanitized_content = wp_kses($content, $allowed_html);
     return $sanitized_content;
 }
开发者ID:andy-j-d,项目名称:hover-notification,代码行数:12,代码来源:options.php

示例14: sanitize_output

 public static function sanitize_output($content)
 {
     $allowed = wp_kses_allowed_html('post');
     $options = get_option('iwt_options');
     if (array_key_exists('contentelements', $options) && json_decode($options['contentelements']) != null) {
         $allowed = json_decode($options['contentelements'], true);
     }
     return wp_kses((string) $content, $allowed);
 }
开发者ID:davidized,项目名称:wp-indieweb-post-kinds,代码行数:9,代码来源:class-kind-view.php

示例15: admin_notices

 /**
  * Display the admin notices
  */
 public function admin_notices()
 {
     if (!empty($notices)) {
         foreach ($notices as $notice) {
             echo '<div class="' . esc_attr($notice['type']) . '">
       <p>' . wp_kses($notice['message'], wp_kses_allowed_html('post')) . '</p>
       </div>';
         }
     }
 }
开发者ID:kilbot,项目名称:WooCommerce-Software-License-Manager,代码行数:13,代码来源:notices.php


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