本文整理汇总了PHP中wp_kses_post函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_kses_post函数的具体用法?PHP wp_kses_post怎么用?PHP wp_kses_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_kses_post函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display_ip_blockquote
/**
* Display the International Programs blockquote shortcode.
*
* @param array $atts Attributes assigned to the blockquote display.
* @param string $content Content used in the blockquote element itself.
*
* @return string
*/
public function display_ip_blockquote($atts, $content)
{
$default_atts = array('cite' => '', 'image' => '', 'image_placement' => '', 'wrapper' => '');
$atts = wp_parse_args($atts, $default_atts);
$content = '<blockquote><span class="blockquote-internal"><span class="blockquote-content">' . wp_kses_post($content) . '</span>';
if (!empty($atts['cite'])) {
$content .= '<cite>' . wp_kses_post($atts['cite']) . '</cite>';
}
$content .= '</span></blockquote>';
$atts['wrapper'] = esc_attr($atts['wrapper']);
$atts['wrapper'] = 'blockquote-container ' . $atts['wrapper'];
if (isset($atts['image']) && 0 !== absint($atts['image'])) {
if (empty($atts['image_placement'])) {
$atts['wrapper'] .= ' blockquote-has-image blockquote-has-image-default';
$content = '<div class="column one">' . $content . '</div><div class="column two">' . wp_get_attachment_image($atts['image'], 'thumbnail', false) . '</div>';
} elseif ('together' === $atts['image_placement']) {
$atts['wrapper'] .= ' blockquote-has-image blockquote-has-image-reverse';
$content = '<div class="column one">' . $content . wp_get_attachment_image($atts['image'], 'thumbnail', false) . '</div>';
} elseif ('reverse' === $atts['image_placement']) {
$atts['wrapper'] .= ' blockquote-has-image blockquote-has-image-together';
$content = '<div class="column one">' . wp_get_attachment_image($atts['image'], 'thumbnail', false) . '</div><div class="column two">' . $content . '</div>';
}
}
$content = '<div class="' . esc_attr($atts['wrapper']) . '">' . $content . '</div>';
return $content;
}
开发者ID:ssheilah,项目名称:ip.wsu.edu,代码行数:34,代码来源:shortcode-blockquote.php
示例2: display
/**
* Display meta in a formatted list
*
* @access public
* @param bool $flat (default: false)
* @param bool $return (default: false)
* @param string $hideprefix (default: _)
* @return string
*/
public function display($flat = false, $return = false, $hideprefix = '_')
{
$output = '';
$formatted_meta = $this->get_formatted($hideprefix);
if (!empty($formatted_meta)) {
$meta_list = array();
foreach ($formatted_meta as $meta_key => $meta) {
if ($flat) {
$meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']);
} else {
$meta_list[] = '
<dt class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post($meta['label']) . ':</dt>
<dd class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post(wpautop($meta['value'])) . '</dd>
';
}
}
if (!empty($meta_list)) {
if ($flat) {
$output .= implode(", \n", $meta_list);
} else {
$output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>';
}
}
}
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:39,代码来源:class-wc-order-item-meta.php
示例3: get_media_item
public static function get_media_item($item_data, $align = 'horizontal')
{
if (!is_object($item_data)) {
return '';
}
$title = '';
$caption = '';
$link = '';
$title_template = '<h4>%s</h4>';
if (!empty($item_data->link)) {
$link_url = $item_data->link;
$link = '<a class="swiper-link" href="' . $link_url . '">' . __('Details', 'the7mk2') . '</a>';
$title_template = '<h4><a href="' . $link_url . '">%s</a></h4>';
}
if (!empty($item_data->title)) {
$title = sprintf($title_template, wp_kses($item_data->title, array()));
}
if (!empty($item_data->description)) {
$caption = wpautop(wp_kses_post($item_data->description));
}
$image = dt_get_thumb_img(array('echo' => false, 'img_meta' => array($item_data->full, $item_data->width, $item_data->height), 'img_id' => $item_data->ID, 'alt' => $item_data->alt, 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %ALT% />', 'prop' => false));
$info = $title . $caption . $link;
if ($info) {
$info = sprintf('<span class="link show-content"></span>
<div class="swiper-caption">
%s
<span class="close-link"></span>
</div>', $info);
}
$html = sprintf('<div class="swiper-slide">
%s
%s
</div>', $image, $info);
return $html;
}
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:35,代码来源:slider-swapper.class.php
示例4: sanitizeString
/**
* Sanitize the input string. HTML tags can be permitted.
* The permitted tags can be supplied in an array.
*
* @TODO: Finish the code needed to support the $permittedTags array.
*
* @param string $string
* @param bool $allowHTML [optional]
* @param array $permittedTags [optional]
* @return string
*/
public function sanitizeString($string, $allowHTML = FALSE, $permittedTags = array())
{
// Strip all tags except the permitted.
if (!$allowHTML) {
// Ensure all tags are closed. Uses WordPress method balanceTags().
$balancedText = balanceTags($string, TRUE);
$strippedText = strip_tags($balancedText);
// Strip all script and style tags.
$strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $strippedText);
// Escape text using the WordPress method and then strip slashes.
$escapedText = stripslashes(esc_attr($strippedText));
// Remove line breaks and trim white space.
$escapedText = preg_replace('/[\\r\\n\\t ]+/', ' ', $escapedText);
return trim($escapedText);
} else {
// Strip all script and style tags.
$strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
$strippedText = preg_replace('/<(script|style).*?>.*?<\\/\\1>/si', '', stripslashes($strippedText));
/*
* Use WordPress method make_clickable() to make links clickable and
* use kses for filtering.
*
* http://ottopress.com/2010/wp-quickie-kses/
*/
return wptexturize(wpautop(make_clickable(wp_kses_post($strippedText))));
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:38,代码来源:class.utility.php
示例5: display
/**
* Display meta in a formatted list.
*
* @param bool $flat (default: false)
* @param bool $return (default: false)
* @param string $hideprefix (default: _)
* @param string $delimiter Delimiter used to separate items when $flat is true
* @return string|void
*/
public function display($flat = false, $return = false, $hideprefix = '_', $delimiter = ", \n")
{
$output = '';
$formatted_meta = $this->get_formatted($hideprefix);
if (!empty($formatted_meta)) {
$meta_list = array();
foreach ($formatted_meta as $meta) {
if ($flat) {
$meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']);
} else {
$meta_list[] = '
<dt class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post($meta['label']) . ':</dt>
<dd class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post(wpautop(make_clickable($meta['value']))) . '</dd>
';
}
}
if (!empty($meta_list)) {
if ($flat) {
$output .= implode($delimiter, $meta_list);
} else {
$output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>';
}
}
}
$output = apply_filters('woocommerce_order_items_meta_display', $output, $this);
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:40,代码来源:class-wc-order-item-meta.php
示例6: qi_theme_api_call
function qi_theme_api_call($def, $action, $args)
{
global $wp_version, $theme_base, $api_url, $theme_version;
// Add check for 'slug' existence inside $args
// to avoid WordPress.org server error message
// in some screens
if (!property_exists($args, 'slug')) {
return false;
}
if ($args->slug != $theme_base) {
return false;
}
// Get the current version
$args->version = $theme_version;
$request_string = array('body' => array('action' => $action, 'request' => json_encode($args), 'api-key' => md5(esc_url(home_url('/')))), 'user-agent' => 'WordPress/' . $wp_version . '; ' . esc_url(home_url('/')));
$request = wp_remote_post($api_url, $request_string);
if (is_wp_error($request)) {
$res = new WP_Error('themes_api_failed', wp_kses_post(__('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>', 'quadro')), $request->get_error_message());
} else {
$res = unserialize($request['body']);
if ($res === false) {
$res = new WP_Error('themes_api_failed', esc_html__('An unknown error occurred', 'quadro'), $request['body']);
}
}
return $res;
}
开发者ID:unsognoverde,项目名称:website,代码行数:26,代码来源:update.php
示例7: create_field
function create_field($field)
{
// vars
$o = array('id', 'class', 'name', 'value', 'placeholder');
$e = '';
// prepend
if ($field['prepend'] !== "") {
$field['class'] .= ' acf-is-prepended';
$e .= '<div class="acf-input-prepend">' . wp_kses_post($field['prepend']) . '</div>';
}
// append
if ($field['append'] !== "") {
$field['class'] .= ' acf-is-appended';
$e .= '<div class="acf-input-append">' . wp_kses_post($field['append']) . '</div>';
}
$e .= '<div class="acf-input-wrap">';
$e .= '<input type="email"';
foreach ($o as $k) {
$e .= ' ' . $k . '="' . esc_attr($field[$k]) . '"';
}
$e .= ' />';
$e .= '</div>';
// return
echo $e;
}
开发者ID:ffffranklin,项目名称:cmarianiantiques,代码行数:25,代码来源:email.php
示例8: widget
public function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
echo $before_widget;
echo '<div class="twitter-widget-wrapper">';
if ($title) {
echo $before_title . $title . $after_title;
}
if (function_exists('fw_ssd_twitter_feed')) {
$tweets = fw_ssd_twitter_feed($instance['tweet_count'], $instance['username']);
if (!is_wp_error($tweets) && !empty($tweets)) {
$output = '';
$output .= '<ul>';
if (!empty($tweets['error'])) {
$output .= '<li><div class="tweet-content">' . $tweets['error'] . '</div></li>';
} else {
foreach ($tweets as $tweet) {
if (!empty($tweet['tweet'])) {
$output .= '<li><div class="tweet-content">' . $tweet['tweet'] . '</div> <span class="tweet-time">' . $tweet['time'] . '</span></li>';
}
}
}
$output .= '</ul>';
}
}
echo wp_kses_post($output);
echo '</div><!-- end twitter-widget-wrapper -->';
echo $after_widget;
}
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:30,代码来源:class-widget-twitter.php
示例9: shortcode_ui_dev_shortcode
function shortcode_ui_dev_shortcode($attr, $content = '')
{
//Parse the attribute of the shortcode
$attr = wp_parse_args($attr, array('source' => '', 'attachment' => 0));
ob_start();
?>
<section class="pullquote" style="padding: 20px; background: rgba(0,0,0,0.1);">
<p style="margin:0; padding: 0;">
<b>Content:</b> <?php
echo wpautop(wp_kses_post($content));
?>
</br>
<b>Source:</b> <?php
echo esc_html($attr['source']);
?>
</br>
<b>Image:</b> <?php
echo wp_kses_post(wp_get_attachment_image($attr['attachment'], array(50, 50)));
?>
</br>
</p>
</section>
<?php
return ob_get_clean();
}
开发者ID:scherii,项目名称:Shortcake,代码行数:27,代码来源:dev.php
示例10: theshop_section_cta
/**
* Call to action section
*
*/
function theshop_section_cta()
{
if (!get_theme_mod('cta_activate', 1)) {
return;
}
$text = get_theme_mod('cta_text', 'Are you ready to see more?');
$button_title = get_theme_mod('cta_button_title', 'VISIT OUR SHOP');
$button_url = get_theme_mod('cta_button_url', '#');
?>
<section class="home-section cta-section">
<div class="container">
<p class="cta-text"><?php
echo wp_kses_post($text);
?>
</p>
<a class="button" href="<?php
echo esc_url($button_url);
?>
"><?php
echo esc_html($button_title);
?>
</a>
</div>
</section>
<?php
}
开发者ID:sammykumar,项目名称:goodbeads,代码行数:32,代码来源:sections.php
示例11: add_cat_to_db
function add_cat_to_db()
{
global $wpdb, $current_user;
if ($_REQUEST['action'] == 'add') {
$category_name = isset($_REQUEST['category_name']) && !empty($_REQUEST['category_name']) ? esc_html($_REQUEST['category_name']) : '';
$category_identifier = isset($_REQUEST['category_identifier']) && !empty($_REQUEST['category_identifier']) ? $category_identifier = sanitize_title_with_dashes($_REQUEST['category_identifier']) : ($category_identifier = sanitize_title_with_dashes($category_name . '-' . time()));
$category_desc = isset($_REQUEST['category_desc']) && !empty($_REQUEST['category_desc']) ? wp_kses_post($_REQUEST['category_desc']) : '';
$display_category_desc = isset($_REQUEST['display_desc']) && !empty($_REQUEST['display_desc']) ? $_REQUEST['display_desc'] : '';
if (!function_exists('espresso_member_data')) {
$current_user->ID = 1;
}
$category_meta['use_pickers'] = isset($_REQUEST['use_pickers']) && !empty($_REQUEST['use_pickers']) ? $_REQUEST['use_pickers'] : '';
$category_meta['event_background'] = isset($_REQUEST['event_background']) && !empty($_REQUEST['event_background']) ? $_REQUEST['event_background'] : '';
$category_meta['event_text_color'] = isset($_REQUEST['event_text_color']) && !empty($_REQUEST['event_text_color']) ? $_REQUEST['event_text_color'] : '';
$category_meta = serialize($category_meta);
$sql = array('category_name' => $category_name, 'category_identifier' => $category_identifier, 'category_desc' => $category_desc, 'display_desc' => $display_category_desc, 'category_meta' => $category_meta, 'wp_user' => $current_user->ID);
$sql_data = array('%s', '%s', '%s', '%s', '%s', '%d');
if ($wpdb->insert(EVENTS_CATEGORY_TABLE, $sql, $sql_data)) {
?>
<div id="message" class="updated fade"><p><strong><?php
_e('The category has been added.', 'event_espresso');
?>
</strong></p></div>
<?php
} else {
?>
<div id="message" class="error"><p><strong><?php
_e('The category was not saved.', 'event_espresso');
?>
</strong></p></div>
<?php
}
}
}
开发者ID:HandsomeDogStudio,项目名称:peanutbutterplan,代码行数:35,代码来源:add_cat_to_db.php
示例12: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('PhoenixTeam_Widget_Twitter', $instance['title']);
$username = $instance['username'] ? $instance['username'] : null;
$number = isset($instance['qty']) ? $instance['qty'] : null;
static $counter = 1;
// IDs for Widget;
// echo $args['before_widget']; // It's the right way, but doesn't work with VC :(
echo '<div id="' . THEME_SLUG . '-twitter-' . esc_attr($counter) . '" class="footer-twitter widget_' . THEME_SLUG . '-twitter">';
if ($title) {
echo '<h4 class="widget-title">' . esc_html($title) . '</h4>';
}
// $tweets = $this->get_tweets($args['widget_id'], $instance); // Good old, but doesn't work with VC
$tweets = $this->get_tweets(THEME_SLUG . '-twitter-' . $counter, $instance);
if (!empty($tweets['tweets']) && empty($tweets['tweets']->errors)) {
$user = current($tweets['tweets']);
if (is_object($user)) {
$user = $user->user;
}
echo '<ul class="tweet_list">';
$checker = 0;
foreach ($tweets['tweets'] as $tweet) {
if ($checker <= $number) {
if (isset($tweet->text)) {
if (is_object($tweet)) {
$avatar = $user->profile_image_url;
$username = $user->screen_name;
$user_url = 'https://twitter.com/' . $username;
$tweet_text = htmlentities($tweet->text, ENT_QUOTES, 'UTF-8');
$tweet_text = make_clickable($tweet_text);
$tweet_text = popuplinks($tweet_text);
if ($tweet_text) {
echo '<li>
<a class="tweet_avatar" href="' . esc_url($user_url) . '">
<img src="' . esc_url($avatar) . '" alt="' . esc_attr($username) . '" title="' . esc_attr($username) . '">
</a>
<span class="tweet_text">' . wp_kses_post($tweet_text) . '</span>
</li>';
$checker++;
}
}
} else {
if ($checker == 0) {
echo '<li><span class="content">' . __("There's no tweets in your feed...", 'grandway') . '</span></li>';
break;
}
break;
}
}
}
echo '</ul>';
} elseif ($tweets['tweets']->errors) {
_e('Authentication failed! Please check your Twitter app data.', 'grandway');
} elseif (!$tweets['tweets']) {
_e("There's no tweets there", 'grandway');
}
echo $args['after_widget'];
$counter++;
}
开发者ID:WillLin,项目名称:CS-SC-Front-End,代码行数:60,代码来源:widget-twitter.php
示例13: get_login_options
private static function get_login_options()
{
$login_options = array();
$targets = array();
if (wskl_is_option_enabled('fb_login')) {
$targets[] = 'fb';
}
if (wskl_is_option_enabled('naver_login')) {
$targets[] = 'naver';
}
foreach ($targets as $prefix) {
$login_link_text = get_option(wskl_get_option_name($prefix . '_login_link_text'), '[icon]');
if ($login_link_text && !empty($login_link_text)) {
switch ($prefix) {
case 'fb':
$img_url = plugin_dir_url(WSKL_MAIN_FILE) . "assets/image/social-login/facebook.png";
$alt = __('페이스북으로 로그인', 'wskl');
break;
case 'naver':
$img_url = plugin_dir_url(WSKL_MAIN_FILE) . "assets/image/social-login/naver.png";
$alt = __('네이버 아이디로 로그인', 'wskl');
break;
default:
$img_url = '';
$alt = '';
}
$login_link_text = str_replace('[icon]', sprintf('<img src="%s" class="%s" alt="%s" title="%3$s">', esc_attr($img_url), esc_attr('auth-provider-icon '), esc_attr($alt)), $login_link_text);
$login_link_text = wp_kses_post($login_link_text);
$login_options[$prefix] = array('href' => esc_url("/index.php?sym-api=service-social-login-{$prefix}"), 'link_title' => $login_link_text, 'alt' => $alt);
}
}
return $login_options;
}
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:33,代码来源:class-social-login.php
示例14: update_event_category
function update_event_category()
{
global $wpdb;
$category_id = $_REQUEST['category_id'];
$category_name = esc_html($_REQUEST['category_name']);
$category_identifier = $_REQUEST['category_identifier'] == '' ? $category_identifier = sanitize_title_with_dashes($category_name . '-' . time()) : ($category_identifier = sanitize_title_with_dashes($_REQUEST['category_identifier']));
$category_desc = wp_kses_post($_REQUEST['category_desc']);
$display_category_desc = $_REQUEST['display_desc'];
$category_meta['use_pickers'] = isset($_REQUEST['use_pickers']) && !empty($_REQUEST['use_pickers']) ? $_REQUEST['use_pickers'] : '';
$category_meta['event_background'] = isset($_REQUEST['event_background']) && !empty($_REQUEST['event_background']) ? $_REQUEST['event_background'] : '';
$category_meta['event_text_color'] = isset($_REQUEST['event_text_color']) && !empty($_REQUEST['event_text_color']) ? $_REQUEST['event_text_color'] : '';
//echo "<pre>".print_r($_POST,true)."</pre>";
$category_meta = serialize($category_meta);
$sql = array('category_name' => $category_name, 'category_identifier' => $category_identifier, 'category_desc' => $category_desc, 'display_desc' => $display_category_desc, 'category_meta' => $category_meta);
$update_id = array('id' => $category_id);
$sql_data = array('%s', '%s', '%s', '%s', '%s');
if ($wpdb->update(EVENTS_CATEGORY_TABLE, $sql, $update_id, $sql_data, array('%d'))) {
?>
<div id="message" class="updated fade"><p><strong><?php
_e('The category has been updated.', 'event_espresso');
?>
</strong></p></div>
<?php
} else {
?>
<div id="message" class="error"><p><strong><?php
_e('The category was not updated.', 'event_espresso');
?>
</strong></p></div>
<?php
}
}
开发者ID:HandsomeDogStudio,项目名称:peanutbutterplan,代码行数:33,代码来源:update_event_category.php
示例15: 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
示例16: customizer_do
function customizer_do($wp_customize)
{
//////// PANELS ////////
$wp_customize->add_panel('wider_flux_layout', array('title' => $this->db_key == 'wonderflux_display' ? esc_html__('Wonderflux', 'wp-flux-layout') : esc_html__('Flux Layout', 'wp-flux-layout'), 'description' => __(wp_kses_post('Flux Layout Generates a dynamic responsive CSS grid - any columns, any width (almost!). <a href="http://fluxlayout.com" target="_blank">Visit the Flux Layout website</a> for more information on how to use this.'), 'wp-flux-layout')));
//////// SECTIONS ////////
$wp_customize->add_section('wider_fluxl_core', array('title' => esc_html__('Layout', 'wp-flux-layout'), 'description' => esc_html__('Setup the dimensions of your CSS layout columns (grid system).', 'wp-flux-layout'), 'panel' => 'wider_flux_layout'));
$wp_customize->add_section('wider_fluxl_content', array('title' => esc_html__('Content and sidebar', 'wp-flux-layout'), 'description' => esc_html__('Setup the dimensions of your main content area and sidebar.', 'wp-flux-layout'), 'panel' => 'wider_flux_layout'));
$wp_customize->add_section('wider_fluxl_config', array('title' => esc_html__('Configuration', 'wp-flux-layout'), 'description' => esc_html__('Configure other Wonderflux settings.', 'wp-flux-layout'), 'panel' => 'wider_flux_layout'));
////// CONTROLS //////
// Common Flux Layout controls
$controls = array($this->db_key . '[columns_num]' => array('label' => esc_html__('Number of Vertical columns', 'wp-flux-layout'), 'desc' => esc_html__('Number of vertical columns in your main layout. Flux Layout also includes other common columns configurations automatically.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['columns_num'], 'transport' => 'refresh', 'section' => 'wider_fluxl_core', 'type' => 'select_range', 'val_low' => 2, 'val_high' => 100, 'val_step' => 1, 'sanitize' => 'numeric'), $this->db_key . '[container_w]' => array('label' => esc_html__('Main container width', 'wp-flux-layout'), 'desc' => esc_html__('% width of central main content container.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['container_w'], 'transport' => 'refresh', 'section' => 'wider_fluxl_core', 'type' => 'select_range', 'val_low' => 5, 'val_high' => 100, 'val_step' => 5, 'sanitize' => 'numeric'), $this->db_key . '[container_p]' => array('label' => esc_html__('Main container position', 'wp-flux-layout'), 'desc' => esc_html__('Position the main content of the site within the browser viewport.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['container_p'], 'transport' => 'refresh', 'section' => 'wider_fluxl_core', 'type' => 'select', 'choices' => array('left' => 'Left', 'middle' => 'Middle', 'right' => 'Right'), 'sanitize' => 'no_html'), $this->db_key . '[sidebar_p]' => array('label' => esc_html__('Sidebar position', 'wp-flux-layout'), 'desc' => esc_html__('Position sidebar left or right of the main content.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['sidebar_p'], 'transport' => 'refresh', 'section' => 'wider_fluxl_content', 'type' => 'select', 'choices' => array('left' => 'Left', 'right' => 'Right'), 'sanitize' => 'no_html'));
// Wonderflux specific controls
$wfx_controls = array($this->db_key . '[content_s]' => array('label' => esc_html__('Content width', 'wp-flux-layout'), 'desc' => esc_html__('Relative size to site width.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['content_s'], 'transport' => 'refresh', 'section' => 'wider_fluxl_core', 'type' => 'select', 'choices' => $this->common_size, 'sanitize' => 'no_html'), $this->db_key . '[sidebar_s]' => array('label' => esc_html__('Sidebar width', 'wp-flux-layout'), 'desc' => esc_html__('Relative size to site width.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['sidebar_s'], 'transport' => 'refresh', 'section' => 'wider_fluxl_core', 'type' => 'select', 'choices' => $this->common_size, 'sanitize' => 'no_html'), $this->db_key . '[rwd_full]' => array('label' => esc_html__('Sidebar/main content breakpoint', 'wp-flux-layout'), 'desc' => esc_html__('Media query breakpoint for when sidebar and content goes full width for smaller screens.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['rwd_full'], 'transport' => 'refresh', 'section' => 'wider_fluxl_content', 'type' => 'select', 'choices' => array('tiny' => 'Tiny', 'small' => 'Small', 'medium' => 'Medium', 'large' => 'Large'), 'sanitize' => 'no_html'), $this->db_key . '[sidebar_d]' => array('label' => esc_html__('Sidebar display', 'wp-flux-layout'), 'desc' => esc_html__('Do you want to show or hide the sidebar sitewide (can override with filter.)', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['sidebar_d'], 'transport' => 'refresh', 'section' => 'wider_fluxl_content', 'type' => 'select', 'choices' => array('Y' => 'Show', 'N' => 'Hide'), 'sanitize' => 'no_html'), $this->db_key . '[content_s_px]' => array('label' => esc_html__('Media width', 'wp-flux-layout'), 'desc' => esc_html__('Sets WordPress $content_width. Pixel width of embeded media such as YouTube - Flux Layout makes this responsive for you.', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['content_s_px'], 'transport' => 'refresh', 'section' => 'wider_fluxl_content', 'type' => 'select_range', 'val_low' => 200, 'val_high' => 1200, 'val_step' => 5, 'sanitize' => 'numeric'), $this->db_key . '[doc_type]' => array('label' => esc_html__('Document type', 'wp-flux-layout'), 'desc' => esc_html__('Default: transitional', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['doc_type'], 'transport' => 'postMessage', 'section' => 'wider_fluxl_config', 'type' => 'select', 'choices' => array('transitional' => esc_attr__('transitional', 'wp-flux-layout'), 'strict' => esc_attr__('strict', 'wp-flux-layout'), 'frameset' => esc_attr__('frameset', 'wp-flux-layout'), '1.1' => esc_attr__('1.1', 'wp-flux-layout'), '1.1basic' => esc_attr__('1.1basic', 'wp-flux-layout'), 'html5' => esc_attr__('html5', 'wp-flux-layout'), 'XHTML/RDFa' => esc_attr__('XHTML/RDFa', 'wp-flux-layout')), 'sanitize' => 'no_html'), $this->db_key . '[doc_lang]' => array('label' => esc_html__('Document language', 'wp-flux-layout'), 'desc' => esc_html__('Default: en', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['doc_lang'], 'transport' => 'postMessage', 'section' => 'wider_fluxl_config', 'type' => 'select', 'choices' => array('aa' => 'aa', 'ab' => 'ab', 'ae' => 'ae', 'af' => 'af', 'ak' => 'ak', 'am' => 'am', 'an' => 'an', 'ar' => 'ar', 'as' => 'as', 'av' => 'av', 'ay' => 'ay', 'az' => 'az', 'ba' => 'ba', 'be' => 'be', 'bg' => 'bg', 'bh' => 'bh', 'bi' => 'bi', 'bm' => 'bm', 'bn' => 'bn', 'bo' => 'bo', 'br' => 'br', 'bs' => 'bs', 'ca' => 'ca', 'ce' => 'ce', 'ch' => 'ch', 'co' => 'co', 'cr' => 'cr', 'cs' => 'cs', 'cu' => 'cu', 'cv' => 'cv', 'da' => 'da', 'de' => 'de', 'dv' => 'dv', 'dz' => 'dz', 'ee' => 'ee', 'el' => 'el', 'en' => 'en', 'eo' => 'eo', 'es' => 'es', 'et' => 'et', 'eu' => 'eu', 'eu' => 'eu', 'fa' => 'fa', 'ff' => 'ff', 'fi' => 'fi', 'fj' => 'fj', 'fo' => 'fo', 'fr' => 'fr', 'fy' => 'fy', 'ga' => 'ga', 'gd' => 'gd', 'gl' => 'gl', 'gn' => 'gn', 'gu' => 'gu', 'gv' => 'gv', 'ha' => 'ha', 'he' => 'he', 'hi' => 'hi', 'ho' => 'ho', 'hr' => 'hr', 'ht' => 'ht', 'hu' => 'hu', 'hy' => 'hy', 'hz' => 'hz', 'ia' => 'ia', 'id' => 'id', 'ie' => 'ie', 'ig' => 'ig', 'ii' => 'ii', 'ik' => 'ik', 'io' => 'io', 'is' => 'is', 'it' => 'it', 'iu' => 'iu', 'ja' => 'ja', 'jv' => 'jv', 'ka' => 'ka', 'kg' => 'kg', 'ki' => 'ki', 'kj' => 'kj', 'kk' => 'kk', 'kl' => 'kl', 'km' => 'km', 'kn' => 'kn', 'ko' => 'ko', 'kr' => 'kr', 'ks' => 'ks', 'ku' => 'ku', 'kv' => 'kv', 'kw' => 'kw', 'ky' => 'ky', 'la' => 'la', 'lb' => 'lb', 'lg' => 'lg', 'li' => 'li', 'ln' => 'ln', 'lo' => 'lo', 'lt' => 'lt', 'lu' => 'lu', 'lv' => 'lv', 'mg' => 'mg', 'mh' => 'mh', 'mi' => 'mi', 'mk' => 'mk', 'ml' => 'ml', 'mn' => 'mn', 'mr' => 'mr', 'ms' => 'ms', 'mt' => 'mt', 'my' => 'my', 'na' => 'na', 'nb' => 'nb', 'nd' => 'nd', 'ne' => 'ne', 'ng' => 'ng', 'nl' => 'nl', 'nn' => 'nn', 'no' => 'no', 'nr' => 'nr', 'nv' => 'nv', 'ny' => 'ny', 'oc' => 'oc', 'oj' => 'oj', 'om' => 'om', 'or' => 'or', 'os' => 'os', 'pa' => 'pa', 'pi' => 'pi', 'pl' => 'pl', 'ps' => 'ps', 'pt' => 'pt', 'qu' => 'qu', 'rm' => 'rm', 'rn' => 'rn', 'ro' => 'ro', 'ru' => 'ru', 'rw' => 'rw', 'sa' => 'sa', 'sc' => 'sc', 'sd' => 'sd', 'se' => 'se', 'sg' => 'sg', 'si' => 'si', 'sk' => 'sk', 'sl' => 'sl', 'sm' => 'sm', 'sn' => 'sn', 'so' => 'so', 'sq' => 'sq', 'sr' => 'sr', 'ss' => 'ss', 'st' => 'st', 'su' => 'su', 'sv' => 'sv', 'sw' => 'sw', 'ta' => 'ta', 'te' => 'te', 'tg' => 'tg', 'th' => 'th', 'ti' => 'ti', 'tk' => 'tk', 'tl' => 'tl', 'tn' => 'tn', 'to' => 'to', 'tr' => 'tr', 'ts' => 'ts', 'tt' => 'tt', 'tw' => 'tw', 'ty' => 'ty', 'ug' => 'ug', 'uk' => 'uk', 'ur' => 'ur', 'uz' => 'uz', 've' => 've', 'vi' => 'vi', 'vo' => 'vo', 'wa' => 'wa', 'wo' => 'wo', 'xh' => 'xh', 'yi' => 'yi', 'yo' => 'yo', 'za' => 'za', 'zh' => 'zh', 'zu' => 'zu'), 'sanitize' => 'no_html'), $this->db_key . '[page_t]' => array('label' => esc_html__('No sidebar template', 'wp-flux-layout'), 'desc' => esc_html__('Hide this Wonderflux page template if it does not suit your child theme (it will be removed from page template dropdown option in admin.)', 'wp-flux-layout'), 'datatype' => $this->datatype, 'default' => $this->default_vals['page_t'], 'transport' => 'postMessage', 'section' => 'wider_fluxl_config', 'type' => 'select', 'choices' => array('' => 'Show no sidebar template', 'no-sidebar' => 'Hide no sidebar template'), 'sanitize' => 'no_html'));
// Merged extra Wonderflux controls into array for setup if required
$controls = $this->db_key == 'wonderflux_display' ? array_merge($controls, $wfx_controls) : $controls;
// Build the controls
foreach ($controls as $opt => $val) {
$wp_customize->add_setting($opt, array('type' => $val['datatype'], 'default' => isset($val['default']) ? $val['default'] : false, 'transport' => $val['transport'], 'sanitize_callback' => isset($val['sanitize']) ? array($this, 'sanitize_' . $val['sanitize']) : false, 'sanitize_js_callback' => isset($val['sanitize']) ? array($this, 'sanitize_' . $val['sanitize']) : false));
switch ($val['type']) {
case 'image_upload':
$wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, $opt, array('label' => $val['label'], 'section' => $val['section'], 'settings' => $opt, 'description' => isset($val['desc']) ? $val['desc'] : false)));
break;
case 'select':
$wp_customize->add_control($opt, array('label' => $val['label'], 'section' => $val['section'], 'type' => $val['type'], 'choices' => $val['choices'], 'description' => isset($val['desc']) ? $val['desc'] : false));
break;
case 'select_range':
$vals = $this->helper_int_range($val['val_low'], $val['val_high'], $val['val_step']);
$wp_customize->add_control($opt, array('label' => $val['label'], 'section' => $val['section'], 'type' => 'select', 'choices' => $vals, 'description' => isset($val['desc']) ? $val['desc'] : false));
break;
default:
$wp_customize->add_control($opt, array('label' => $val['label'], 'section' => $val['section'], 'type' => $val['type'], 'description' => isset($val['desc']) ? $val['desc'] : false));
break;
}
}
}
开发者ID:We-Are-Wider,项目名称:wp-flux-layout,代码行数:35,代码来源:wider-flux-customizer.php
示例17: get_post_excerpt
function get_post_excerpt($post_or_post_id = null, $length = 100)
{
$post = null;
$result = "";
if (!$post_or_post_id) {
$post_or_post_id = get_the_ID();
}
if (is_object($post_or_post_id)) {
$post = $post_or_post_id;
} else {
if (is_numeric($post_or_post_id)) {
$post = get_post($post_or_post_id);
} else {
return '';
//throw new Exception( '### Error in VcModule/get_post_excerpt, no post nor post_id given! ###' );
}
}
$excerpt = html_entity_decode($post->post_excerpt);
if (empty($excerpt)) {
$excerpt = html_entity_decode(strip_tags($post->post_content));
}
if (strlen($excerpt) > $length) {
$line = $excerpt;
if (preg_match('/^.{1,' . $length . '}\\b/s', $excerpt, $match)) {
$line = $match[0];
}
$excerpt = $line . '...<br/>Läs mer!';
}
return wp_kses_post($excerpt);
}
开发者ID:ekandreas,项目名称:aekab,代码行数:30,代码来源:extras.php
示例18: wp_stream_fail_php_version
/**
* Invoked when the PHP version check fails
* Load up the translations and add the error message to the admin notices.
*/
function wp_stream_fail_php_version()
{
load_plugin_textdomain('stream', false, dirname(plugin_basename(__FILE__)) . '/languages/');
$message = esc_html__('Stream requires PHP version 5.3+, plugin is currently NOT ACTIVE.', 'stream');
$html_message = sprintf('<div class="error">%s</div>', wpautop($message));
echo wp_kses_post($html_message);
}
开发者ID:azanebrain,项目名称:representme,代码行数:11,代码来源:stream.php
示例19: |
请发表评论