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


PHP msp_get_the_relative_media_url函数代码示例

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


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

示例1: 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($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('"', '&quote;', $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'] : '', '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;
 }
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:70,代码来源:class-msp-parser.php

示例2: get_wc_slider_ms_slides_shortcode

 public function get_wc_slider_ms_slides_shortcode()
 {
     if (!isset($this->parsed_slider_data['slides'])) {
         return '';
     }
     $slides = $this->parsed_slider_data['slides'];
     $query = array();
     $query['image_from'] = $this->parsed_slider_data['setting']['ps_image_from'];
     $query['excerpt_length'] = $this->parsed_slider_data['setting']['ps_excerpt_len'];
     $exclude_posts_no_img = $this->parsed_slider_data['setting']['ps_exclude_no_img'];
     $query['only_featured'] = $this->parsed_slider_data['setting']['wc_only_featured'];
     $query['only_instock'] = $this->parsed_slider_data['setting']['wc_only_instock'];
     $query['only_onsale'] = $this->parsed_slider_data['setting']['wc_only_onsale'];
     if (!empty($this->parsed_slider_data['setting']['ps_post_type'])) {
         $query['post_type'] = $this->parsed_slider_data['setting']['ps_post_type'];
     }
     $query['orderby'] = $this->parsed_slider_data['setting']['ps_orderby'];
     $query['order'] = $this->parsed_slider_data['setting']['ps_order'];
     $query['posts_per_page'] = $this->parsed_slider_data['setting']['ps_post_count'];
     if (!empty($this->parsed_slider_data['setting']['ps_posts_not_in'])) {
         $posts_not_in = explode(',', $this->parsed_slider_data['setting']['ps_posts_not_in']);
         $query['post__not_in'] = array_filter($posts_not_in);
     }
     if (!empty($this->parsed_slider_data['setting']['ps_posts_in'])) {
         $posts_in = explode(',', $this->parsed_slider_data['setting']['ps_posts_in']);
         $query['post__in'] = array_filter($posts_in);
     }
     $query['offset'] = $this->parsed_slider_data['setting']['ps_offset'];
     $taxs_data = array();
     if (!empty($this->parsed_slider_data['setting']['ps_tax_term_ids'])) {
         $taxs_data = explode(',', $this->parsed_slider_data['setting']['ps_tax_term_ids']);
     }
     $tax_query = array();
     $wcs = msp_get_wc_slider_class();
     $query['tax_query'] = $wcs->get_tax_query($taxs_data);
     $query['image_size'] = 'full';
     $query = apply_filters('msp_wc_slider_query_args', $query, $this->parsed_slider_data);
     $this->post_slider_args = $query;
     $slides_shortcode = '';
     $th_wp_query = $wcs->get_query_results($query);
     if ($th_wp_query->have_posts()) {
         while ($th_wp_query->have_posts()) {
             $th_wp_query->the_post();
             $product = get_product($th_wp_query->post);
             $slide_content = '';
             $attrs = '';
             $this->post_id = $th_wp_query->post->ID;
             if (empty($this->parsed_slider_data['setting']['ps_slide_bg'])) {
                 $the_media = msp_get_auto_post_thumbnail_url($th_wp_query->post, $query['image_from']);
             } else {
                 $the_media = $this->parsed_slider_data['setting']['ps_slide_bg'];
             }
             // skip this post if it does not have image and $exclude_posts_no_img is enabled
             if (empty($the_media) && 'true' == $exclude_posts_no_img) {
                 continue;
             }
             $attrs .= sprintf('%s="%s" ', 'src', esc_attr($the_media));
             // generate slide_info shortcode if slideinfo control is added
             if (isset($this->parsed_slider_data['setting']['slideinfo']) && 'true' == $this->parsed_slider_data['setting']['slideinfo']) {
                 if (!empty($slides['0']['info'])) {
                     $slide_info = preg_replace_callback('/{{[\\w-]+}}/', array($this, 'do_template_tag'), $slides['0']['info']);
                 } else {
                     $slide_info = " ";
                 }
                 $slide_content .= $this->get_ms_slide_info_shortcode($slide_info);
             }
             if ($this->parsed_slider_data['setting']['ps_link_slide']) {
                 $attrs .= sprintf('%s="%s" ', 'link', get_the_permalink($th_wp_query->post->ID));
             }
             $attrs .= sprintf('%s="%s" ', 'title', $this->escape_square_brackets(get_the_title($th_wp_query->post->ID)));
             $attrs .= sprintf('%s="%s" ', 'alt', $this->escape_square_brackets(get_the_title($th_wp_query->post->ID)));
             $attrs .= sprintf('%s="%s" ', 'target', $this->parsed_slider_data['setting']['ps_link_target']);
             $attrs .= sprintf('%s="%s" ', 'delay', $slides['0']['delay']);
             // bg color and align for slides
             $attrs .= sprintf('%s="%s" ', 'bgalign', $slides['0']['bgalign']);
             $attrs .= sprintf('%s="%s" ', 'bgcolor', $slides['0']['bgcolor']);
             if ('true' == $this->parsed_slider_data['setting']['thumbs']) {
                 if ('thumbs' == $this->parsed_slider_data['setting']['thumbs_type']) {
                     if (!empty($the_media)) {
                         // set custom thumb size if slider template is gallery
                         if ('image-gallery' == $this->parsed_slider_data['setting']['template']) {
                             $thumb = msp_get_the_resized_image_src($the_media, 175, 140, true);
                         } else {
                             $thumb = msp_get_the_resized_image_src($the_media, $this->parsed_slider_data['setting']['thumbs_width'], $this->parsed_slider_data['setting']['thumbs_height'], true);
                         }
                         $thumb = msp_get_the_relative_media_url($thumb);
                         $attrs .= sprintf('%s="%s" ', 'thumb', $thumb);
                     } else {
                         $tab = '<div class=&quot;ms-thumb-alt&quot;>' . get_the_title($th_wp_query->post->ID) . '</div>';
                         $attrs .= sprintf('%s="%s" ', 'tab', $tab);
                     }
                 } elseif ('tabs' == $this->parsed_slider_data['setting']['thumbs_type']) {
                     // if "insert thumb" option was enabled generate and add the thumbnail
                     if ('true' == $this->parsed_slider_data['setting']['thumbs_in_tab']) {
                         $thumb_height = $this->parsed_slider_data['setting']['thumbs_height'];
                         $tab_thumb = msp_get_auto_post_thumbnail_url($th_wp_query->post, 'featured', array($thumb_height, $thumb_height), true);
                         $attrs .= sprintf('%s="%s" ', 'tab_thumb', $tab_thumb);
                     }
                     if (!empty($slides['0']['info'])) {
                         $tab_context = preg_replace_callback('/{{[\\w-]+}}/', array($this, 'do_template_tag'), $slides['0']['info']);
//.........这里部分代码省略.........
开发者ID:pab44,项目名称:pab44,代码行数:101,代码来源:class-msp-shortcode-factory.php

示例3: gallery_output


//.........这里部分代码省略.........
     $slider_attrs['slideinfo_height'] = '30';
     $slider_attrs['skin'] = $atts['skin'];
     $slider_attrs['preload'] = $atts['preload'];
     $slider_attrs['auto_height'] = $atts['auto_height'];
     // Whether thumbail is enables or not
     $has_thumb = 'true' === $atts['thumbs'];
     $has_tab = !$has_thumb && 'tabs' === $atts['thumbs_type'];
     $has_slideinfo = 'true' === $atts['caption'];
     // Add thumbnail options id enabled
     if ($has_thumb) {
         $slider_attrs['thumbs'] = $atts['thumbs'];
         $slider_attrs['thumbs_type'] = $atts['thumbs_type'];
         $slider_attrs['thumbs_align'] = $atts['thumbs_align'];
         $slider_attrs['thumbs_width'] = $atts['thumbs_width'];
         $slider_attrs['thumbs_height'] = $atts['thumbs_height'];
         $slider_attrs['thumbs_space'] = $atts['thumbs_space'];
         $slider_attrs['thumbs_inset'] = $atts['thumbs_inset'];
         $slider_attrs['thumbs_autohide'] = $atts['thumbs_autohide'];
         $slider_attrs['thumbs_margin'] = $atts['thumbs_margin'];
         if ('bottom' == $slider_attrs['thumbs_align']) {
             $slider_attrs['slideinfo_margin'] = '80';
         }
     } elseif ($has_tab) {
         $slider_attrs['thumbs_type'] = 'tabs';
     }
     if ($has_slideinfo) {
         $slider_attrs['slideinfo'] = 'true';
         $slider_attrs['slideinfo_inset'] = 'true';
         $slider_attrs['slideinfo_height'] = '30';
     }
     // get attachments
     if (!empty($atts['include'])) {
         $_attachments = get_posts(array('include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
         $attachments = array();
         foreach ($_attachments as $key => $val) {
             $attachments[$val->ID] = $_attachments[$key];
         }
     } elseif (!empty($atts['exclude'])) {
         $attachments = get_children(array('post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
     } else {
         $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
     }
     // skip if no attachments found
     if (empty($attachments)) {
         return '';
     }
     $slides_shortcode = '';
     foreach ($attachments as $id => $attachment) {
         $attrs = '';
         $img_src = msp_get_the_resized_attachment_src($id, 1400);
         $attrs .= sprintf('%s="%s" ', 'src', $img_src);
         $attrs .= sprintf('%s="%s" ', 'src_full', $img_src);
         if ('file' == $atts['link']) {
             $link = $img_src;
         } elseif ('none' == $atts['link']) {
             $link = '';
         } else {
             $link = get_permalink($id);
         }
         if (!empty($link)) {
             $attrs .= sprintf('%s="%s" ', 'link', $link);
         }
         $info = '';
         if (empty($attachment->post_excerpt)) {
             $attrs .= sprintf('%s="%s" ', 'alt', $attachment->post_excerpt);
         } else {
             $attrs .= sprintf('%s="%s" ', 'alt', $attachment->post_title);
         }
         if ($has_slideinfo) {
             $caption = $attachment->post_excerpt ? $attachment->post_excerpt : $attachment->post_title;
             $info = sprintf('[ms_slide_info]%s[/ms_slide_info]%s', $caption, "\n");
         }
         $attrs .= sprintf('%s="%s" ', 'target', $atts['target']);
         $attrs .= sprintf('%s="%s" ', 'delay', $atts['delay']);
         if ($has_thumb) {
             $thumb = msp_get_the_resized_image_src($img_src, $atts['thumbs_width'], $atts['thumbs_height'], true);
             $thumb = msp_get_the_relative_media_url($thumb);
             $attrs .= sprintf('%s="%s" ', 'thumb', $thumb);
         } elseif ($has_tab) {
             $tab = '<div class=&quot;ms-thumb-alt&quot;>' . $attachment->post_title . '</div>';
             $attrs .= sprintf('%s="%s" ', 'tab', $tab);
         }
         $slides_shortcode .= sprintf('[ms_slide %1$s]%3$s%2$s[/ms_slide]%3$s', $attrs, $info, "\n");
     }
     /**
      * Filter slider default attributes. To find full list of slider options, take a look at "msp_masterslider_wrapper_shortcode"
      * function in /includes/msp-shortcodes.php file
      * 
      * @var array      List of slider options with values
      */
     $slider_attrs = apply_filters('masterslider_gallery_slider_attrs', $slider_attrs);
     // Convert attrs to string
     $slides_shortcode_attrs = '';
     foreach ($slider_attrs as $slider_attr => $slider_attr_value) {
         $slides_shortcode_attrs .= sprintf('%s="%s" ', $slider_attr, $slider_attr_value);
     }
     // Create slider shortcode
     $gallery_slider_shortcode = sprintf('[ms_slider %1$s]%2$s%3$s[/ms_slider]', $slides_shortcode_attrs, "\n", $slides_shortcode);
     return do_shortcode($gallery_slider_shortcode);
 }
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:101,代码来源:class-msp-gallery-extention.php

示例4: msp_the_relative_media_url

/**
 * Print relative URL for media file event if the URL is absolute
 * 
 * @param  string $url  The link to media file
 * @return void
 */
function msp_the_relative_media_url($url)
{
    echo msp_get_the_relative_media_url($url);
}
开发者ID:blogfor,项目名称:king,代码行数:10,代码来源:msp-functions.php

示例5: 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']) : '', '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('"', '&quote;', $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'] : '');
     return $slides;
 }
开发者ID:jonyheim,项目名称:jony-io,代码行数:38,代码来源:class-msp-parser.php


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