本文整理汇总了PHP中vc_value_from_safe函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_value_from_safe函数的具体用法?PHP vc_value_from_safe怎么用?PHP vc_value_from_safe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_value_from_safe函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vcex_textarea_html
/**
* Add textarea param that accepts html
*
* @since 2.0.0
*/
public static function vcex_textarea_html($settings, $value)
{
$rows = isset($settings['vcex_rows']) ? $settings['vcex_rows'] : 5;
return '<textarea name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textarea_raw_html ' . $settings['param_name'] . ' textarea_safe" rows="' . $rows . '">' . vc_value_from_safe($value) . '</textarea>';
}
示例2: vc_textarea_safe_form_field
/**
* Safe Textarea shortcode attribute type generator.
*
* @param $settings
* @param $value
*
* @since 4.4
* @return string - html string.
*/
function vc_textarea_safe_form_field($settings, $value)
{
return '<textarea name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textarea_raw_html ' . $settings['param_name'] . ' ' . $settings['type'] . '">' . vc_value_from_safe($value, true) . '</textarea>';
}
示例3: get_the_ID
$el_start = '';
$el_end = '';
$slides_wrap_start = '';
$slides_wrap_end = '';
$pretty_rand = 'link_image' === $onclick ? ' rel="prettyPhoto[rel-' . get_the_ID() . '-' . rand() . ']"' : '';
wp_enqueue_script('vc_carousel_js');
wp_enqueue_style('vc_carousel_css');
if ('link_image' === $onclick) {
wp_enqueue_script('prettyphoto');
wp_enqueue_style('prettyphoto');
}
if ('' === $images) {
$images = '-1,-2,-3';
}
if ('custom_link' === $onclick) {
$custom_links = vc_value_from_safe($custom_links);
$custom_links = explode(',', $custom_links);
}
$images = explode(',', $images);
$i = -1;
$class_to_filter = 'wpb_images_carousel wpb_content_element vc_clearfix';
$class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts);
$carousel_id = 'vc_images-carousel-' . WPBakeryShortCode_VC_images_carousel::getCarouselIndex();
$slider_width = $this->getSliderWidth($img_size);
?>
<div class="<?php
echo esc_attr(apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $css_class, $this->settings['base'], $atts));
?>
">
<div class="wpb_wrapper">
示例4: buildItems
public function buildItems()
{
$this->filter_terms = $this->items = array();
$this->setContentLimits();
$this->addExcludedId($this->postID());
if ('custom' === $this->atts['post_type'] && !empty($this->atts['custom_query'])) {
$query = html_entity_decode(vc_value_from_safe($this->atts['custom_query']), ENT_QUOTES, 'utf-8');
$post_data = query_posts($query);
$this->atts['items_per_page'] = -1;
} elseif (false !== $this->atts['query_items_per_page']) {
$settings = $this->filterQuerySettings($this->buildQuery($this->atts));
$post_data = query_posts($settings);
} else {
return;
}
if ($this->atts['items_per_page'] > 0 && count($post_data) > $this->atts['items_per_page']) {
$post_data = array_slice($post_data, 0, $this->atts['items_per_page']);
}
foreach ($post_data as $post) {
$post->filter_terms = wp_get_object_terms($post->ID, $this->atts['filter_source'], array('fields' => 'ids'));
$this->filter_terms = wp_parse_args($this->filter_terms, $post->filter_terms);
$this->items[] = $post;
}
}
示例5: singleParamEditForm
protected function singleParamEditForm($param, $param_value)
{
$param_line = '';
// Textfield - input
if ($param['type'] == 'textfield') {
$value = __($param_value, "js_composer");
$value = htmlspecialchars($value);
//$value = $param_value;
$param_line .= '<input name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '"/>';
} else {
if ($param['type'] == 'dropdown') {
$css_option = vc_get_dropdown_option($param, $param_value);
$param_line .= '<select name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-input wpb-select ' . $param['param_name'] . ' ' . $param['type'] . ' ' . $css_option . '" data-option="' . $css_option . '">';
foreach ($param['value'] as $text_val => $val) {
if (is_numeric($text_val) && (is_string($val) || is_numeric($val))) {
$text_val = $val;
}
$text_val = __($text_val, "js_composer");
//$val = strtolower(str_replace(array(" "), array("_"), $val));
//$val = strtolower(str_replace(array(" "), array("_"), $val)); //issue #464 github
$selected = '';
if ($param_value !== '' && (string) $val === (string) $param_value) {
$selected = ' selected="selected"';
}
$param_line .= '<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . htmlspecialchars($text_val) . '</option>';
}
$param_line .= '</select>';
} else {
if ($param['type'] == 'textarea_html') {
if ($this->html_editor_already_is_used !== false) {
$param_value = __($param_value, "js_composer");
$param_line .= '<textarea name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-textarea ' . $param['param_name'] . ' textarea">' . $param_value . '</textarea>';
$param_line .= '<div class="updated"><p>' . __('Field type is changed from `textarea_html` to `textarea`, because it is already used by `' . $this->html_editor_already_is_used . '` field. Textarea_html field\'s type can be used only once per shortcode.', 'js_composer') . '</p></div>';
} else {
$this->html_editor_already_is_used = $param['param_name'];
$param_line .= do_shortcode_param_settings_field('textarea_html', $param, $param_value);
}
// $param_line .= $this->getTinyHtmlTextArea($param, $param_value);
} else {
if ($param['type'] == 'checkbox') {
// param_line .= '<input class="wpb_vc_param_value wpb-checkboxes" type="hidden" value="" name="'.$param['param_name'].'"/>';
$current_value = explode(",", $param_value);
$values = is_array($param['value']) ? $param['value'] : array();
foreach ($values as $label => $v) {
$checked = in_array($v, $current_value) ? ' checked="checked"' : '';
$param_line .= ' <input id="' . $param['param_name'] . '-' . $v . '" value="' . $v . '" class="wpb_vc_param_value ' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . $checked . '> ' . __($label, "js_composer");
}
} else {
if ($param['type'] == 'posttypes') {
// $param_line .= '<input class="wpb_vc_param_value wpb-checkboxes" type="hidden" value="" name="'.$param['param_name'].'"/>';
$args = array('public' => true);
$post_types = get_post_types($args);
foreach ($post_types as $post_type) {
$checked = "";
if ($post_type != 'attachment') {
if (in_array($post_type, explode(",", $param_value))) {
$checked = ' checked="checked"';
}
$param_line .= ' <input id="' . $param['param_name'] . '-' . $post_type . '" value="' . $post_type . '" class="wpb_vc_param_value ' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . $checked . '> ' . $post_type;
}
}
} else {
if ($param['type'] == 'taxonomies' || $param['type'] == 'taxomonies') {
// $param_line .= '<input class="wpb_vc_param_value wpb-checkboxes" type="hidden" value="" name=""/>';
$post_types = get_post_types(array('public' => false, 'name' => 'attachment'), 'names', 'NOT');
foreach ($post_types as $type) {
$taxonomies = get_object_taxonomies($type, '');
foreach ($taxonomies as $tax) {
$checked = "";
if (in_array($tax->name, explode(",", $param_value))) {
$checked = ' checked="checked"';
}
$param_line .= ' <label data-post-type="' . $type . '"><input id="' . $param['param_name'] . '-' . $tax->name . '" value="' . $tax->name . '" data-post-type="' . $type . '" class="wpb_vc_param_value ' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . $checked . '> ' . $tax->label . '</label>';
}
}
} else {
if ($param['type'] == 'exploded_textarea') {
$param_value = str_replace(",", "\n", $param_value);
$param_line .= '<textarea name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>';
} else {
if ($param['type'] == 'textarea_raw_html') {
// $param_value = __($param_value, "js_composer");
$param_line .= '<textarea name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-textarea_raw_html ' . $param['param_name'] . ' ' . $param['type'] . '" rows="16">' . htmlentities(rawurldecode(base64_decode($param_value)), ENT_COMPAT, 'UTF-8') . '</textarea>';
} else {
if ($param['type'] == 'textarea_safe') {
// $param_value = __($param_value, "js_composer");
$param_line .= '<textarea name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-textarea_raw_html ' . $param['param_name'] . ' ' . $param['type'] . '">' . vc_value_from_safe($param_value, true) . '</textarea>';
} else {
if ($param['type'] == 'textarea') {
$param_value = __($param_value, "js_composer");
$param_line .= '<textarea name="' . $param['param_name'] . '" class="wpb_vc_param_value wpb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>';
} else {
if ($param['type'] == 'attach_images') {
// TODO: More native way
$param_value = wpb_removeNotExistingImgIDs($param_value);
$param_line .= '<input type="hidden" class="wpb_vc_param_value gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '"/>';
//$param_line .= '<a class="button gallery_widget_add_images" href="#" title="'.__('Add images', "js_composer").'">'.__('Add images', "js_composer").'</a>';
$param_line .= '<div class="gallery_widget_attached_images">';
$param_line .= '<ul class="gallery_widget_attached_images_list">';
$param_line .= $param_value != '' ? fieldAttachedImages(explode(",", $param_value)) : '';
//.........这里部分代码省略.........
示例6: get_the_ID
$type = ' wpb_image_grid';
}
if ('' === $images) {
$images = '-1,-2,-3';
}
$pretty_rel_random = ' rel="prettyPhoto[rel-' . get_the_ID() . '-' . rand() . ']"';
if ('custom_link' === $onclick) {
$custom_links = vc_value_from_safe($custom_links);
$custom_links = explode(',', $custom_links);
}
switch ($source) {
case 'media_library':
$images = explode(',', $images);
break;
case 'external_link':
$images = vc_value_from_safe($custom_srcs);
$images = explode(',', $images);
break;
}
foreach ($images as $i => $image) {
switch ($source) {
case 'media_library':
if ($image > 0) {
$img = wpb_getImageBySize(array('attach_id' => $image, 'thumb_size' => $img_size));
$thumbnail = $img['thumbnail'];
$large_img_src = $img['p_img_large'][0];
} else {
$large_img_src = $default_src;
$thumbnail = '<img src="' . $default_src . '" />';
}
break;
示例7: extract
<?php
$output = '';
extract(shortcode_atts(array('text' => 'I am testimonial. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'author' => '', 'company' => '', 'avatar' => ''), $atts));
$output .= '<li class="caroufredsel-item">';
$output .= '<div class="testimonial-wrap">';
$output .= '<div class="testimonial-text">';
$output .= '<span>“</span>' . trim(vc_value_from_safe($text)) . '<span>”</span>';
$output .= '</div>';
if (!empty($avatar)) {
$avatar_image = wp_get_attachment_image_src($avatar, 'dh-full');
$output .= '<div class="testimonial-avatar">';
$output .= '<img src="' . $avatar_image[0] . '" alt="' . $avatar . '"/>';
$output .= "</div>";
}
if (!empty($author)) {
$output .= '<div class="testimonial-author">';
$output .= esc_html($author);
$output .= '</div>';
}
if (!empty($company)) {
$output .= '<div class="testimonial-company">';
$output .= esc_html($company);
$output .= '</div>';
}
$output .= '</div>';
$output .= '</li>';
echo $output;
示例8: extract
<?php
$output = '';
extract(shortcode_atts(array('text' => 'I am testimonial. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'author' => '', 'company' => '', 'avatar' => ''), $atts));
$output .= '<li class="caroufredsel-item col-sm-6">';
$output .= '<div class="testimonial-wrap">';
$output .= '<div class="testimonial-text">';
$output .= '<span>“</span>' . trim(vc_value_from_safe($text)) . '<span>”</span>';
$output .= '</div>';
$output .= '<div class="clearfix">';
if (!empty($avatar)) {
$avatar_image = wp_get_attachment_image_src($avatar, 'thumbnail');
$output .= '<div class="testimonial-avatar">';
$output .= '<img src="' . $avatar_image[0] . '" alt="' . $avatar . '"/>';
// $output .='<a href="#" class="caroufredsel-prev"></a>';
// $output .='<a href="#" class="caroufredsel-next"></a>';
$output .= "</div>";
}
if (!empty($author)) {
$output .= '<span class="testimonial-author">';
$output .= esc_html($author);
$output .= '</span>';
}
if (!empty($company)) {
$output .= '<span class="testimonial-company">';
$output .= esc_html($company);
$output .= '</span>';
}
$output .= '</div>';
$output .= '</div>';
$output .= '</li>';
示例9: array
* www.laborator.co
*/
# Atts
$defaults = array('height' => '', 'zoom' => '', 'map_options' => '', 'map_panby' => '', 'map_controls' => '', 'map_style' => '', 'map_type' => '', 'map_tilt' => '', 'map_heading' => '', 'el_class' => '', 'css' => '');
if (function_exists('vc_map_get_attributes')) {
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
}
extract($atts);
$map_id = uniqid('el_');
$map_options = explode(',', $map_options);
$map_controls = explode(',', $map_controls);
$map_style_safe = vc_value_from_safe($map_style);
// New bug fix
$map_style_b64dec = rawurldecode(base64_decode(strip_tags($map_style)));
if (strpos($map_style, '#E-') == 0) {
$map_style = vc_value_from_safe($map_style);
if ($map_style_b64dec && strpos($map_style_b64dec, '[') >= 0 && substr(trim($map_style_b64dec), 0, 1) == '[') {
$map_style = $map_style_b64dec;
}
} elseif (base64_decode($map_style)) {
$map_style = $map_style_b64dec;
}
$height = is_numeric($height) && $height > 10 ? $height : 400;
$map_locations = array();
if (preg_match_all('/' . get_shortcode_regex() . '/', $content, $map_locations_match)) {
foreach ($map_locations_match[0] as $location) {
$location = preg_replace("/^\\[[^\\s]+/i", "", substr($location, 0, -1));
$location_details = $this->prepareAtts(shortcode_parse_atts($location));
$location_details = shortcode_atts(array('marker_image' => '', 'retina_marker' => '', 'latitude' => '0', 'longitude' => '0', 'marker_title' => '', 'marker_description' => ''), $location_details);
if ($location_details['marker_image']) {
$pin = wp_get_attachment_image_src($location_details['marker_image'], 'original');
示例10: agni_video
public static function agni_video($atts = null, $content = null)
{
$atts = shortcode_atts(array('fullwidth' => '', 'height' => '', 'url' => '#', 'auto_play' => 'false', 'loop' => 'false', 'vol' => '50', 'mute' => 'false', 'start_at' => '0', 'quality' => 'default', 'embed' => '', 'class' => ''), $atts, 'video');
if ($atts['fullwidth'] != 'yes') {
$output = '<div class="' . $atts['class'] . ' custom-video embed-responsive embed-responsive-16by9">
' . trim(vc_value_from_safe($atts['embed'])) . '
</div> ';
} else {
$height = '';
if ($atts['height'] != '') {
$height = 'style="height:' . $atts['height'] . 'px"';
}
$output = '<div class="' . $atts['class'] . ' section-video-container" ' . $height . '>
<a id="bgndVideo-2" class="player" data-property="{videoURL:\'' . $atts['url'] . '\', containment:\'.section-video-container\', showControls:false, autoPlay:' . $atts['auto_play'] . ', loop:' . $atts['loop'] . ', vol:' . $atts['vol'] . ', mute:' . $atts['mute'] . ', startAt:' . $atts['start_at'] . ', opacity:1, addRaster:false, quality:\'' . $atts['quality'] . '\'}">' . $atts['url'] . '</a>
<div class="overlay"></div>
</div>
<div class="section-video-controls">
<a class="command command-play large-icon" href="#"></a>
<a class="command command-pause large-icon" href="#"></a>
</div>';
}
return $output;
}
示例11: array
/**
* Team Member
*
* Laborator.co
* www.laborator.co
*/
global $team_member_index, $columns_count, $reveal_effect, $hover_style, $img_size;
# Atts
$defaults = array('image' => '', 'name' => '', 'sub_title' => '', 'description' => '', 'link' => '', 'el_class' => '');
#$atts = vc_shortcode_attribute_parse( $defaults, $atts );
if (function_exists('vc_map_get_attributes')) {
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
}
extract($atts);
if (strpos($description, '#E-') !== false) {
$description = vc_value_from_safe($description);
$description = nl2br($description);
}
# Element Class
$class = $this->getExtraClass($el_class);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class, $this->settings['base'], $atts);
# If no image return empty
if (!$image) {
return;
}
$thumb_size = $img_size;
$link = vc_build_link($link);
# Wow Effect
$wow_effect = $reveal_effect;
$wow_one_by_one = false;
if (preg_match("/-one/", $wow_effect)) {
示例12: extract
<?php
$output = '';
extract(shortcode_atts(array('text' => 'I am testimonial. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'author' => '', 'company' => '', 'avatar' => ''), $atts));
$output .= '<li class="caroufredsel-item">';
$output .= '<div class="testimonial-wrap">';
$output .= '<div class="testimonial-text">';
$output .= '<span><i class="elegant_icon_quotations"></i></span>' . trim(vc_value_from_safe($text)) . '';
$output .= '</div>';
if (!empty($avatar)) {
$avatar_image = wp_get_attachment_image_src($avatar, 'thumbnail');
$output .= '<div class="testimonial-avatar">';
$output .= '<img src="' . $avatar_image[0] . '" alt="' . $avatar . '"/>';
$output .= "</div>";
}
if (!empty($author)) {
$output .= '<div class="testimonial-author">';
$output .= esc_html($author);
$output .= '</div>';
}
if (!empty($company)) {
$output .= '<div class="testimonial-company">';
$output .= esc_html($company);
$output .= '</div>';
}
$output .= '</div>';
$output .= '</li>';
echo $output;
示例13: array
*/
# Atts
$defaults = array('typed_text' => '', 'typed_show_options' => '', 'typed_options_cursorchar' => '', 'typed_options_loopcount' => '', 'typed_options_typespeed' => '', 'typed_options_backspeed' => '', 'typed_options_startdelay' => '', 'typed_options_backdelay' => '', 'el_class' => '', 'css' => '');
#$atts = vc_shortcode_attribute_parse($defaults, $atts);
if (function_exists('vc_map_get_attributes')) {
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
}
extract($atts);
# Element Class
$class = $this->getExtraClass($el_class);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class, $this->settings['base'], $atts);
$css_class = "auto-type-element {$css_class}";
# Process Text
$script = '';
# Typed Text
$typed_text_safe = vc_value_from_safe($typed_text);
if (strpos($typed_text, '#E-') == 0) {
$typed_text = $typed_text_safe;
}
if (preg_match_all("/(\\*.*?\\*)/is", $typed_text, $typed_entries)) {
foreach ($typed_entries[0] as $typed_entry) {
$typed_options = array('cursorChar' => $typed_options_cursorchar, 'showCursor' => $typed_options_cursorchar ? true : false, 'loop' => $typed_options_loopcount == -1 || $typed_options_loopcount > 0 ? true : false, 'loopCount' => $typed_options_loopcount > 0 ? $typed_options_loopcount - 1 : 0, 'typeSpeed' => absint($typed_options_typespeed), 'backSpeed' => absint($typed_options_backspeed), 'startDelay' => absint($typed_options_startdelay), 'backDelay' => absint($typed_options_backdelay));
$typed_processed = lab_text_autotype_process_entry($typed_entry, $typed_options);
$typed_text = str_replace($typed_entry, $typed_processed['el'], $typed_text);
$typed_text = preg_replace("/^\\s*<br\\s*(\\/)?>/i", '', $typed_text);
$script .= PHP_EOL . $typed_processed['script'];
}
}
?>
<div class="<?php
echo esc_attr($css_class) . vc_shortcode_custom_css_class($css, ' ');
示例14: vc_map_get_attributes
* @var $this WPBakeryShortCode_VC_Gmaps
*/
$title = $link = $size = $el_class = $css = '';
$output = '';
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
extract($atts);
$zoom = 14;
// deprecated 4.0.2. In 4.6 was moved outside from shortcode_atts
$type = 'm';
// deprecated 4.0.2
$bubble = '';
// deprecated 4.0.2
if ('' === $link) {
return null;
}
$link = trim(vc_value_from_safe($link));
$bubble = $bubble !== '' && $bubble !== '0' ? '&iwloc=near' : '';
$size = str_replace(array('px', ' '), array('', ''), $size);
if (is_numeric($size)) {
$link = preg_replace('/height="[0-9]*"/', 'height="' . $size . '"', $link);
}
$class_to_filter = 'wpb_gmaps_widget wpb_content_element' . ($size === '' ? ' vc_map_responsive' : '');
$class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts);
?>
<div class="<?php
echo esc_attr($css_class);
?>
">
<?php
echo wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_map_heading'));