本文整理汇总了PHP中msp_get_the_absolute_media_url函数的典型用法代码示例。如果您正苦于以下问题:PHP msp_get_the_absolute_media_url函数的具体用法?PHP msp_get_the_absolute_media_url怎么用?PHP msp_get_the_absolute_media_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了msp_get_the_absolute_media_url函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: msp_get_slider_background_css
function msp_get_slider_background_css($slider_id)
{
$slider_data = get_masterslider_parsed_data($slider_id);
$the_slider_bg = empty($slider_data['setting']['bg_color']) ? '' : $slider_data['setting']['bg_color'];
$the_slider_bg .= empty($slider_data['setting']['bg_image']) ? '' : sprintf(' url( %s ) repeat top left', msp_get_the_absolute_media_url($slider_data['setting']['bg_image']));
$the_slider_bg = empty($the_slider_bg) ? '' : 'background:' . $the_slider_bg . ";";
return empty($the_slider_bg) ? '' : sprintf(".ms-parent-id-%d > .master-slider{ %s }", $slider_id, $the_slider_bg);
}
示例2: parse_slide
public function parse_slide($slide = array())
{
// make sure $slide is not serialized
$slide = maybe_unserialize($slide);
if (empty($slide)) {
return $slide;
}
// get slider setting and controls
$slider_setting = $this->get_slider_setting();
// get slide onfo if is set (usage: for tab content if is set)
$info = isset($slide['info']) ? $slide['info'] : '';
if (isset($slide['bg'])) {
$slide_src = msp_get_the_absolute_media_url($slide['bg']);
// generate thumb for master slider panel
msp_get_the_resized_image_src($slide_src, 150, 150, true);
}
$thumb = '';
// add thumb just if thumblist is added to controls list
// also always add thumbnail if slider template is gallery
if ('true' == $slider_setting['thumbs'] && 'thumbs' == $slider_setting['thumbs_type'] || 'image-gallery' == $slider_setting['template']) {
if (isset($slide['thumb']) && !empty($slide['thumb'])) {
$thumb = $slide['thumb'];
$thumb = msp_get_the_relative_media_url($thumb);
} elseif (isset($slide['bg'])) {
// set custom thumb size if slider template is gallery
if ('image-gallery' == $slider_setting['template']) {
$thumb = msp_get_the_resized_image_src($slide_src, 175, 140, true);
} else {
$thumb = msp_get_the_resized_image_src($slide_src, $slider_setting['thumbs_width'], $slider_setting['thumbs_height'], true);
}
$thumb = msp_get_the_relative_media_url($thumb);
} else {
$thumb = '';
}
}
$slides = array('slide_order' => isset($slide['order']) ? (int) $slide['order'] : 0, 'css_class' => isset($slide['cssClass']) ? (string) $slide['cssClass'] : '', 'css_id' => isset($slide['cssId']) ? (string) $slide['cssId'] : '', 'ishide' => $this->is_key_true($slide, 'ishide', 'false'), 'src' => isset($slide['bg']) ? esc_attr(msp_get_the_relative_media_url($slide['bg'])) : '', 'src_full' => isset($slide['bg']) ? esc_attr(msp_get_the_relative_media_url($slide['bg'])) : '', 'title' => '', 'alt' => isset($slide['bgAlt']) ? esc_attr($slide['bgAlt']) : '', 'link' => isset($slide['link']) ? esc_attr($slide['link']) : '', 'rel' => isset($slide['rel']) ? (string) $slide['rel'] : '', 'target' => isset($slide['linkTarget']) ? (string) $slide['linkTarget'] : '', 'video' => isset($slide['video']) ? esc_attr($slide['video']) : '', 'auto_play_video' => $this->is_key_true($slide, 'autoplayVideo', 'false'), 'info' => wp_slash($info), 'mp4' => isset($slide['bgv_mp4']) ? esc_attr($slide['bgv_mp4']) : '', 'webm' => isset($slide['bgv_webm']) ? esc_attr($slide['bgv_webm']) : '', 'ogg' => isset($slide['bgv_ogg']) ? esc_attr($slide['bgv_ogg']) : '', 'autopause' => $this->is_key_true($slide, 'bgv_autopause', 'false'), 'mute' => $this->is_key_true($slide, 'bgv_mute', 'true'), 'loop' => $this->is_key_true($slide, 'bgv_loop', 'true'), 'vbgalign' => isset($slide['bgv_fillmode']) ? (string) $slide['bgv_fillmode'] : 'fill', 'thumb' => $thumb, 'tab' => 'true' == $slider_setting['thumbs'] && 'tabs' == $slider_setting['thumbs_type'] ? str_replace('"', '"e;', $info) : '', 'delay' => isset($slide['duration']) ? (string) $slide['duration'] : '', 'bgalign' => isset($slide['fillMode']) ? (string) $slide['fillMode'] : 'fill', 'bgcolor' => isset($slide['bgColor']) ? (string) $slide['bgColor'] : '', 'pattern' => isset($slide['pattern']) ? (string) $slide['pattern'] : '', 'tintcolor' => isset($slide['colorOverlay']) ? (string) $slide['colorOverlay'] : '', 'layer_ids' => isset($slide['layer_ids']) && !empty($slide['layer_ids']) ? (array) $slide['layer_ids'] : array(), 'layers' => array());
// get all layers in slider
$all_layers = $this->get_layers();
// store slide's layers
$current_layers = array();
// select the layers that belongs to this slide
foreach ($slides['layer_ids'] as $layer_id) {
if (isset($all_layers[$layer_id])) {
$current_layers[] = $all_layers[$layer_id];
}
}
// stores layers by layer order
$layers_by_order = array();
// collect layers by layer order
foreach ($current_layers as $layer) {
$layers_by_order[$layer['order']] = $layer;
}
// sort layers by layer order
ksort($layers_by_order);
// replace real layers data with layers id
$slides['layers'] = $layers_by_order;
return $slides;
}
示例3: parse_slide
public function parse_slide($slide = array())
{
// make sure $slide is not serialized
$slide = maybe_unserialize($slide);
if (empty($slide)) {
return $slide;
}
// get slider setting and controls
$slider_setting = $this->get_slider_setting();
// get slide onfo if is set (usage: for tab content if is set)
$info = isset($slide['info']) ? $slide['info'] : '';
if (isset($slide['bg'])) {
$slide_src = msp_get_the_absolute_media_url($slide['bg']);
// generate thumb for master slider panel
msp_get_the_resized_image_src($slide_src, 150, 150, true);
}
// stores a URL for thumbnail in thumbnail list
$thumb = '';
// add thumb just if thumblist is added to controls list
// also always add thumbnail if slider template is gallery
if ('true' == $slider_setting['thumbs'] && 'thumbs' == $slider_setting['thumbs_type'] || 'image-gallery' == $slider_setting['template']) {
if (isset($slide['thumbOrginal']) && !empty($slide['thumbOrginal'])) {
$thumb = $slide['thumbOrginal'];
$thumb = msp_get_the_relative_media_url($thumb);
} elseif (isset($slide['bg'])) {
// set custom thumb size if slider template is gallery
if ('image-gallery' == $slider_setting['template']) {
$thumb = msp_get_the_resized_image_src($slide_src, 175, 140, true);
} else {
$thumb = msp_get_the_resized_image_src($slide_src, $slider_setting['thumbs_width'], $slider_setting['thumbs_height'], true);
}
$thumb = msp_get_the_relative_media_url($thumb);
}
}
// stores a URL for thumbnail in tab
$tab_thumb = '';
// get thumb for tab if thumblist is added to controls list
if ('true' == $slider_setting['thumbs'] && 'tabs' == $slider_setting['thumbs_type'] && 'true' == $slider_setting['thumbs_in_tab']) {
if (isset($slide['thumbOrginal']) && !empty($slide['thumbOrginal'])) {
$tab_thumb = $slide['thumbOrginal'];
$tab_thumb = msp_get_the_relative_media_url($tab_thumb);
} elseif (isset($slide['bg'])) {
// generate a square thumb for tab
$tab_thumb = msp_get_the_resized_image_src($slide_src, $slider_setting['thumbs_height'], $slider_setting['thumbs_height'], true);
$tab_thumb = msp_get_the_relative_media_url($tab_thumb);
}
}
$slides = array('slide_order' => isset($slide['order']) ? (int) $slide['order'] : 0, 'css_class' => isset($slide['cssClass']) ? (string) $slide['cssClass'] : '', 'css_id' => isset($slide['cssId']) ? (string) $slide['cssId'] : '', 'ishide' => $this->is_key_true($slide, 'ishide', 'false'), 'src' => isset($slide['bg']) ? esc_attr(msp_get_the_relative_media_url($slide['bg'])) : '', 'src_full' => isset($slide['bg']) ? esc_attr(msp_get_the_relative_media_url($slide['bg'])) : '', 'title' => '', 'alt' => isset($slide['bgAlt']) ? esc_attr($slide['bgAlt']) : '', 'link' => isset($slide['link']) ? esc_attr($slide['link']) : '', 'target' => isset($slide['linkTarget']) ? (string) $slide['linkTarget'] : '', 'link_title' => isset($slide['linkTitle']) ? (string) $slide['linkTitle'] : '', 'link_class' => isset($slide['linkClass']) ? (string) $slide['linkClass'] : '', 'link_id' => isset($slide['linkId']) ? (string) $slide['linkId'] : '', 'link_rel' => isset($slide['linkRel']) ? (string) $slide['linkRel'] : '', 'video' => isset($slide['video']) ? esc_attr($slide['video']) : '', 'auto_play_video' => $this->is_key_true($slide, 'autoplayVideo', 'false'), 'info' => wp_slash(do_shortcode($info)), 'mp4' => isset($slide['bgv_mp4']) ? esc_attr($slide['bgv_mp4']) : '', 'webm' => isset($slide['bgv_webm']) ? esc_attr($slide['bgv_webm']) : '', 'ogg' => isset($slide['bgv_ogg']) ? esc_attr($slide['bgv_ogg']) : '', 'autopause' => $this->is_key_true($slide, 'bgv_autopause', 'false'), 'mute' => $this->is_key_true($slide, 'bgv_mute', 'true'), 'loop' => $this->is_key_true($slide, 'bgv_loop', 'true'), 'vbgalign' => isset($slide['bgv_fillmode']) ? (string) $slide['bgv_fillmode'] : 'fill', 'thumb' => $thumb, 'tab' => 'true' == $slider_setting['thumbs'] && 'tabs' == $slider_setting['thumbs_type'] ? str_replace('"', '"e;', $info) : '', 'tab_thumb' => $tab_thumb, 'delay' => isset($slide['duration']) ? (string) $slide['duration'] : '', 'bgalign' => isset($slide['fillMode']) ? (string) $slide['fillMode'] : 'fill', 'bgcolor' => isset($slide['bgColor']) ? (string) $slide['bgColor'] : '', 'pattern' => isset($slide['pattern']) ? (string) $slide['pattern'] : '', 'tintcolor' => isset($slide['colorOverlay']) ? (string) $slide['colorOverlay'] : '');
return $slides;
}
示例4: msp_masterslider_layer_shortcode
function msp_masterslider_layer_shortcode($atts, $content = null)
{
// merge input and default attrs
$merged = shortcode_atts(array('src' => '', 'src_blank' => MSWP_BLANK_IMG, 'widthlimit' => '-1', 'type' => 'text', 'resize' => 'true', 'css_class' => '', 'btn_class' => 'ms-default-btn', 'css_id' => '', 'style_id' => '', 'action' => 'next', 'use_action' => 'false', 'to_slide' => 1, 'action_scroll_duration' => 2, 'offsetx' => '', 'offsety' => '', 'origin' => 'tl', 'fixed' => 'false', 'show_effect' => 'fade', 'show_duration' => '1000', 'show_delay' => '0', 'show_ease' => 'linear', 'style' => '', 'use_hide' => 'false', 'hide_effect' => '', 'hide_duration' => '1000', 'hide_delay' => '1000', 'hide_ease' => '', 'title' => '', 'tooltip_align' => 'top', 'tooltip_stay_hover' => 'true', 'tooltip_width' => '', 'parallax' => '', 'rel' => '', 'alt' => '', 'link' => '', 'target' => '_blank', 'video' => '', 'auto_play_video' => 'false', 'width' => '', 'height' => ''), $atts, 'masterslider_layer');
extract($merged);
$wrapper_class = trim('ms-layer ' . $css_class . ' ' . $style_id);
$id_attr = empty($css_id) ? '' : 'id="' . $css_id . '"';
// position attrs
$data_offset_x = empty($offsetx) ? 'data-offset-x="0"' : 'data-offset-x="' . rtrim($offsetx, 'px') . '"';
$data_offset_y = empty($offsety) ? 'data-offset-y="0"' : 'data-offset-y="' . rtrim($offsety, 'px') . '"';
$data_origin = empty($origin) ? 'data-origin="tl"' : 'data-origin="' . $origin . '"';
// custom style + size styles
$style_size = $style;
// dont't add width and height style for hotspot
if ('hotspot' !== $type) {
$style_size .= empty($width) ? '' : 'width:' . rtrim($width, 'px') . 'px;';
$style_size .= empty($height) ? '' : 'height:' . rtrim($height, 'px') . 'px;';
}
$show_duration = !is_numeric($show_duration) || empty($show_duration) ? 1000 : (int) $show_duration;
$show_delay = !is_numeric($show_delay) || empty($show_delay) ? 0 : (int) $show_delay;
$hide_duration = !is_numeric($hide_duration) || empty($hide_duration) ? 1000 : (int) $hide_duration;
$hide_delay = !is_numeric($hide_delay) || empty($hide_delay) ? 1000 : (int) $hide_delay;
$hide_start_time = $show_duration + $show_delay + $hide_delay;
// create widthlimit attr if it's not default value
$data_widthlimit = (int) $widthlimit < 1 ? '' : 'data-widthlimit="' . (int) $widthlimit . '"';
// create type attr if it's not default value
$data_type = 'text' === $type ? '' : 'data-type="' . $type . '"';
// create resize attr if it's not default value
$data_resize = 'true' == $resize || 'yes' == $resize ? '' : 'data-resize="' . $resize . '"';
// create show_effect attr if it's not default value
$data_show_effect = 'fade' === $show_effect ? '' : 'data-effect="' . $show_effect . '"';
// create show_duration attr if it's not default value
$data_show_duration = 1000 === (int) $show_duration ? '' : 'data-duration="' . (int) $show_duration . '"';
// create show_delay attr if it's not default value
$data_show_delay = 0 === (int) $show_delay ? '' : 'data-delay="' . (int) $show_delay . '"';
// create show_ease attr if it's not default value
$data_show_ease = 'data-ease="' . $show_ease . '"';
// create parallax attr if it's not default value
$data_parallax = empty($parallax) ? '' : 'data-parallax="' . $parallax . '"';
// create fixed attr if it's not default value
$data_fixed = 'true' === $fixed ? 'data-fixed="true"' : '';
if ('true' != $use_hide) {
$data_hide_effect = $data_hide_duration = $data_hide_time = $data_hide_ease = $data_hide_delay = '';
} else {
// create hide_effect attr if it's not default value
$data_hide_effect = empty($hide_effect) ? '' : 'data-hide-effect="' . $hide_effect . '"';
// create hide_duration attr if it's not default value
$data_hide_duration = empty($hide_duration) ? '' : 'data-hide-duration="' . $hide_duration . '"';
// create hide_time attr if it's not default value
$data_hide_time = empty($hide_time) ? '' : 'data-hide-time="' . $hide_time . '"';
// create hide_ease attr if it's not default value
$data_hide_ease = empty($hide_ease) ? '' : 'data-hide-ease="' . $hide_ease . '"';
// create data-hidedelay ease attr if it's not default value
$data_hide_delay = 'data-hide-time="' . $hide_start_time . '"';
}
$rel_attr = empty($rel) ? '' : 'rel="' . $rel . '"';
$rel_attr = apply_filters('masterslider_layer_shortcode_attr_rel', $rel_attr, $rel);
$link = apply_filters('masterslider_layer_shortcode_attr_link', $link);
// create data-link attr if it's not default value
$data_link = empty($link) ? '' : 'data-link="' . $link . '"';
$data_action = '';
// create data-action attr if it's enabled and defined
if ('true' == $use_action) {
if ('gotoSlide' == $action) {
$data_action = 'data-action="' . $action . '(' . ((int) $to_slide - 1) . ')"';
} elseif ('scrollDuration' == $action) {
$data_action = 'data-action="' . $action . '(' . (double) $action_scroll_duration . ')"';
} else {
$data_action = 'data-action="' . $action . '"';
}
$data_link = '';
$link = '#';
}
// convert relative image link to absolute
$src = !empty($src) ? msp_get_the_absolute_media_url($src) : $src;
// add data align if layer type is hotspot
$data_align = 'hotspot' == $type ? 'data-align="' . $tooltip_align . '"' : '';
$data_stay_hover = 'hotspot' == $type ? 'data-stay-hover="' . $tooltip_stay_hover . '"' : '';
$data_tp_width = 'hotspot' == $type ? 'data-width="' . $tooltip_width . '"' : '';
$data_target = 'hotspot' == $type ? 'data-target="' . $target . '"' : '';
$effect_attrs = sprintf('%s %s %s %s %s %s %s %s %s %s', $data_show_effect, $data_show_duration, $data_show_delay, $data_show_ease, $data_hide_effect, $data_hide_duration, $data_hide_time, $data_hide_ease, $data_hide_delay, $data_fixed);
$common_attrs = sprintf('%s %s %s %s %s %s %s %s %s', $data_parallax, $data_type, $data_resize, $data_align, $data_stay_hover, $data_tp_width, $data_target, $data_widthlimit, $data_action);
$position_attrs = sprintf('%s %s %s', $data_offset_x, $data_offset_y, $data_origin);
// store layer markup
$layer = '';
// start layer markup generation /////////////////////////////////////////
// if layer type was image ..
if ('image' == $type) {
// if was linked image
if (!empty($link) && 'true' != $use_action) {
$layer_image = "\n\t" . sprintf('<img src="%s" data-src="%s" alt="%s" style="%s" %s %s %s %s />', $src_blank, $src, $alt, $style_size, $effect_attrs, $data_type, $data_parallax, $position_attrs) . "\n";
$layer .= sprintf('<a %s class="%s" href="%s" target="%s" %s %s >%s</a>', $id_attr, $wrapper_class, $link, $target, $rel_attr, $data_action, $layer_image) . "\n";
// or single image
} else {
$layer .= sprintf('<img %s class="%s" src="%s" data-src="%s" alt="%s" style="%s" %s %s %s %s />', $id_attr, $wrapper_class, $src_blank, $src, $alt, $style_size, $effect_attrs, $common_attrs, $rel_attr, $position_attrs) . "\n";
}
} elseif ('button' == $type) {
$layer_content = !empty($content) ? do_shortcode($content) : '';
$layer = sprintf('<a %s href="%s" target="%s" class="%s %s" %s %s %s %s >%s</a>', $id_attr, $link, $target, $wrapper_class, $btn_class, $effect_attrs, $common_attrs, $position_attrs, $rel_attr, $layer_content) . "\n";
// if layer type was text, video or hotspot
//.........这里部分代码省略.........
示例5: get_ms_layer_shortcode
public function get_ms_layer_shortcode($layer)
{
if (!isset($layer) || empty($layer)) {
return '';
}
$shortcode_name = 'ms_layer';
$attrs = '';
foreach ($layer as $attr => $attr_value) {
if ('content' == $attr) {
continue;
}
if ('parallax' == $attr && 'off' == $this->parsed_slider_data['setting']['parallax_mode']) {
continue;
}
// users can add {{original-image}} and {{slide-image}} in layer link to link layer to current slide image
if ('link' == $attr) {
if (in_array($this->parsed_slider_data['setting']['slider_type'], array('post', 'wc-product'))) {
$attr_value = preg_replace_callback('/{{[\\w-]+}}/', array($this, 'do_template_tag'), $attr_value);
} elseif ('{{slide-image-url}}' == $attr_value) {
$factory = msp_get_parser();
$slide = $factory->get_parent_of_layer($layer['id']);
$attr_value = msp_get_the_absolute_media_url($slide['src_full']);
}
}
$attrs .= sprintf('%s="%s" ', $attr, esc_attr($attr_value));
}
$content = $layer['content'];
if (in_array($this->parsed_slider_data['setting']['slider_type'], array('post', 'wc-product'))) {
$content = preg_replace_callback('/{{[\\w-]+}}/', array($this, 'do_template_tag'), $content);
}
return sprintf('[%1$s %2$s]%4$s%3$s[/%1$s]%4$s', $shortcode_name, $attrs, $content, "\n");
}
示例6: msp_the_absolute_media_url
/**
* Print absolute URL for media file event if the URL is relative
*
* @param string $url The link to media file
* @return void
*/
function msp_the_absolute_media_url($url)
{
echo msp_get_the_absolute_media_url($url);
}