本文整理汇总了PHP中FusionCore_Plugin::get_attachment_id_from_url方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCore_Plugin::get_attachment_id_from_url方法的具体用法?PHP FusionCore_Plugin::get_attachment_id_from_url怎么用?PHP FusionCore_Plugin::get_attachment_id_from_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionCore_Plugin
的用法示例。
在下文中一共展示了FusionCore_Plugin::get_attachment_id_from_url方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_child
/**
* Render the child shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('alt' => '', 'image' => '', 'link' => '', 'linktarget' => '_self'), $args);
extract($defaults);
self::$child_args = $defaults;
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image);
if (!$alt && empty($alt) && $image_id) {
self::$child_args['alt'] = $alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
}
if ($image_id) {
self::$child_args['title_attr'] = get_post_field('post_excerpt', $image_id);
}
$output = sprintf('<img src="%s" alt="%s" />', $image, $alt);
if ($link || self::$parent_args['lightbox'] == 'yes') {
$output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('image-carousel-shortcode-slide-link'), $output);
}
$html = sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('image'), $output);
return $html;
}
示例2: render_child
/**
* Render the child shortcode
*
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
global $smof_data;
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'background_color_front' => $smof_data['flip_boxes_front_bg'], 'background_color_back' => $smof_data['flip_boxes_back_bg'], 'border_color' => $smof_data['flip_boxes_border_color'], 'border_radius' => $smof_data['flip_boxes_border_radius'], 'border_size' => $smof_data['flip_boxes_border_size'], 'circle' => '', 'circle_color' => $smof_data['icon_circle_color'], 'circle_border_color' => $smof_data['icon_border_color'], 'icon' => '', 'icon_color' => $smof_data['icon_color'], 'icon_flip' => '', 'icon_rotate' => '', 'icon_spin' => '', 'image' => '', 'image_width' => '35', 'image_height' => '35', 'text_back_color' => $smof_data['flip_boxes_back_text'], 'text_front' => '', 'text_front_color' => $smof_data['flip_boxes_front_text'], 'title_front' => '', 'title_front_color' => $smof_data['flip_boxes_front_heading'], 'title_back' => '', 'title_back_color' => $smof_data['flip_boxes_back_heading'], 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => '0.1', 'animation_offset' => Avada()->settings->get('animation_offset')), $args);
if ($defaults['border_radius'] == 'round') {
$defaults['border_radius'] = '50%';
}
extract($defaults);
self::$child_args = $defaults;
$style = $icon_output = $title_output = $title_front_output = $title_back_output = $alt = '';
if ($image && $image_width && $image_height) {
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image);
if ($image_id) {
$alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
}
$icon_output = sprintf('<img src="%s" width="%s" height="%s" alt="%s" />', $image, $image_width, $image_height, $alt);
} else {
if ($icon) {
$icon_output = sprintf('<i %s></i>', FusionCore_Plugin::attributes('flip-box-shortcode-icon'));
}
}
if ($icon_output) {
$icon_output = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('flip-box-shortcode-grafix'), $icon_output);
} else {
$icon_output = '';
}
if ($title_front) {
$title_front_output = sprintf('<h2 %s>%s</h2>', FusionCore_Plugin::attributes('flip-box-shortcode-heading-front'), $title_front);
}
if ($title_back) {
$title_back_output = sprintf('<h3 %s>%s</h3>', FusionCore_Plugin::attributes('flip-box-shortcode-heading-back'), $title_back);
}
$front_inner = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('flip-box-front-inner'), $icon_output . $title_front_output . $text_front);
$back_inner = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('flip-box-back-inner'), $title_back_output . do_shortcode($content));
$front = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('flip-box-shortcode-front-box'), $front_inner);
$back = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('flip-box-shortcode-back-box'), $back_inner);
$html = sprintf('<div %s><div class="fusion-flip-box"><div %s>%s%s</div></div></div>', FusionCore_Plugin::attributes('flip-box-shortcode'), FusionCore_Plugin::attributes('flip-box-inner-wrapper'), $front, $back);
$this->flipbox_counter++;
return $html;
}
示例3: render_child
/**
* Render the child shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('avatar' => 'male', 'company' => '', 'image' => '', 'link' => '', 'name' => '', 'target' => '_self', 'gender' => ''), $args);
extract($defaults);
self::$child_args = $defaults;
// check for deprecated
if ($gender) {
self::$child_args['avatar'] = $gender;
}
$inner_content = $thumbnail = $pic = '';
if ($name) {
if (self::$child_args['avatar'] == 'image' && $image) {
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image);
self::$child_args['alt'] = '';
if ($image_id) {
self::$child_args['alt'] = get_post_field('post_excerpt', $image_id);
}
$pic = sprintf('<img %s />', FusionCore_Plugin::attributes('testimonials-shortcode-image'));
}
if (self::$child_args['avatar'] == 'image' && !self::$child_args['image']) {
self::$child_args['avatar'] = 'none';
}
if (self::$child_args['avatar'] != 'none') {
$thumbnail = sprintf('<span %s>%s</span>', FusionCore_Plugin::attributes('testimonials-shortcode-thumbnail'), $pic);
}
$inner_content .= sprintf('<div %s>%s<span %s><strong>%s</strong>', FusionCore_Plugin::attributes('author'), $thumbnail, FusionCore_Plugin::attributes('company-name'), $name);
if ($company) {
if (!empty($link) && $link) {
$inner_content .= sprintf(', <a href="%s" target="%s">%s</a>', $link, $target, sprintf('<span>%s</span>', $company));
} else {
$inner_content .= sprintf(', <span>%s</span>', $company);
}
}
$inner_content .= '</span></div>';
}
$html = sprintf('<div %s><blockquote><q %s>%s</q></blockquote>%s</div>', FusionCore_Plugin::attributes('testimonials-shortcode-review'), FusionCore_Plugin::attributes('testimonials-shortcode-quote'), do_shortcode($content), $inner_content);
return $html;
}
示例4: render_child
/**
* Render the child shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('lightbox' => 'no', 'link' => NULL, 'linktarget' => '_self', 'type' => 'image'), $args);
extract($defaults);
self::$child_args = $defaults;
self::$child_args['alt'] = '';
self::$child_args['title'] = '';
self::$child_args['src'] = $src = str_replace('×', 'x', $content);
if ($type == 'image') {
if (!empty($link) && $link) {
$image_id = FusionCore_Plugin::get_attachment_id_from_url($link);
} else {
$image_id = FusionCore_Plugin::get_attachment_id_from_url($src);
}
if ($image_id) {
self::$child_args['alt'] = get_post_meta($image_id, '_wp_attachment_image_alt', true);
self::$child_args['title'] = get_post_field("post_excerpt", $image_id);
}
}
if ($link && !empty($link) && $type == 'image') {
self::$child_args['link'] = $link;
}
$html = sprintf('<li %s>', FusionCore_Plugin::attributes('slider-shortcode-slide-li'));
if ($link && !empty($link)) {
$html .= sprintf('<a %s>', FusionCore_Plugin::attributes('slider-shortcode-slide-link'));
}
if (!empty($type) && $type == 'video') {
$html .= sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('full-video'), do_shortcode($content));
} else {
$html .= sprintf('<img %s />', FusionCore_Plugin::attributes('slider-shortcode-slide-img'));
}
if ($link && !empty($link)) {
$html .= '</a>';
}
$html .= '</li>';
return $html;
}
示例5: render_child
/**
* Render the child shortcode
*
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => '', 'circle' => '', 'circlecolor' => '', 'circlebordercolor' => '', 'icon' => '', 'iconcolor' => '', 'iconflip' => '', 'iconrotate' => '', 'iconspin' => '', 'image' => '', 'image_height' => '35', 'image_width' => '35', 'link' => '', 'linktarget' => '_self', 'linktext' => '', 'textcolor' => '', 'title' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => '0.1'), $args);
extract($defaults);
self::$child_args = $defaults;
$output = '';
$icon_output = '';
$title_output = '';
$content_output = '';
$link_output = '';
$alt = '';
if ($image && $image_width && $image_height) {
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image);
if ($image_id) {
$alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
}
$icon_output = sprintf('<div %s><img src="%s" width="%s" height="%s" alt="%s" /></div>', FusionCore_Plugin::attributes('content-box-shortcode-icon'), $image, $image_width, $image_height, $alt);
} elseif ($icon) {
$icon_output = sprintf('<div %s><i %s></i></div>', FusionCore_Plugin::attributes('icon'), FusionCore_Plugin::attributes('content-box-shortcode-icon'));
}
if ($title) {
$title_output = sprintf('<h2 %s>%s</h2>', FusionCore_Plugin::attributes('content-box-heading'), $title);
}
if ($link) {
$heading_content = sprintf('<a %s %s>%s</a>', FusionCore_Plugin::attributes('heading-link'), FusionCore_Plugin::attributes('content-box-shortcode-link'), $icon_output . $title_output);
} else {
$heading_content = $icon_output . $title_output;
}
$heading = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('content-box-shortcode-heading-wrapper'), $heading_content);
if ($link && $linktext) {
$link_output = sprintf('<a %s %s>%s</a><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('read-more'), FusionCore_Plugin::attributes('content-box-shortcode-link'), $linktext);
}
$content_output = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('content-box-shortcode-content-container'), do_shortcode($content) . $link_output);
$output = $heading . $content_output;
$html = sprintf('<div %s><div %s>%s</div></div>', FusionCore_Plugin::attributes('content-box-shortcode'), FusionCore_Plugin::attributes('content-box-shortcode-content-wrapper'), $output);
$clearfix_test = $this->column_counter / $this->num_of_columns;
if (is_int($clearfix_test)) {
$html .= '<div class="fusion-clearfix"></div>';
}
$this->column_counter++;
return $html;
}
示例6: render_child
/**
* Render the child shortcode
*
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render_child($args, $content = '')
{
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => self::$parent_args['backgroundcolor'], 'circle' => '', 'circlecolor' => self::$parent_args['circlecolor'], 'circlebordercolor' => self::$parent_args['circlebordercolor'], 'circlebordersize' => self::$parent_args['circlebordersize'], 'outercirclebordercolor' => self::$parent_args['outercirclebordercolor'], 'outercirclebordersize' => self::$parent_args['outercirclebordersize'], 'icon' => '', 'iconcolor' => self::$parent_args['iconcolor'], 'iconrotate' => '', 'iconspin' => '', 'image' => '', 'image_height' => '35', 'image_width' => '35', 'link' => '', 'linktarget' => self::$parent_args['linktarget'], 'linktext' => '', 'textcolor' => '', 'title' => '', 'animation_type' => self::$parent_args['animation_type'], 'animation_direction' => self::$parent_args['animation_direction'], 'animation_speed' => self::$parent_args['animation_speed']), $args);
if ((self::$parent_args['layout'] == 'timeline-vertical' || self::$parent_args['layout'] == 'timeline-horizontal' || self::$parent_args['layout'] == 'clean-vertical' || self::$parent_args['layout'] == 'clean-horizontal') && !$defaults['outercirclebordercolor']) {
//$defaults['outercirclebordercolor'] = '#f6f6f6';
}
if (self::$parent_args['settings_lvl'] == 'parent') {
$defaults['backgroundcolor'] = self::$parent_args['backgroundcolor'];
$defaults['circlecolor'] = self::$parent_args['circlecolor'];
$defaults['circlebordercolor'] = self::$parent_args['circlebordercolor'];
$defaults['circlebordersize'] = self::$parent_args['circlebordersize'];
$defaults['outercirclebordercolor'] = self::$parent_args['outercirclebordercolor'];
$defaults['outercirclebordersize'] = self::$parent_args['outercirclebordersize'];
$defaults['iconcolor'] = self::$parent_args['iconcolor'];
$defaults['animation_type'] = self::$parent_args['animation_type'];
$defaults['animation_direction'] = self::$parent_args['animation_direction'];
$defaults['animation_speed'] = self::$parent_args['animation_speed'];
}
extract($defaults);
self::$child_args = $defaults;
$output = '';
$icon_output = '';
$title_output = '';
$content_output = '';
$link_output = '';
$alt = '';
$heading = '';
if ($image && $image_width && $image_height) {
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image);
if ($image_id) {
$alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
}
$icon_output = sprintf('<div %s><img src="%s" width="%s" height="%s" alt="%s" /></div>', FusionCore_Plugin::attributes('content-box-shortcode-icon'), $image, $image_width, $image_height, $alt);
} elseif ($icon) {
if ($outercirclebordercolor && $outercirclebordersize) {
$icon_output = sprintf('<div %s><span %s><i %s></i></span></div>', FusionCore_Plugin::attributes('content-box-shortcode-icon-parent'), FusionCore_Plugin::attributes('content-box-shortcode-icon-wrapper'), FusionCore_Plugin::attributes('content-box-shortcode-icon'));
} else {
$icon_output = sprintf('<div %s><i %s></i></div>', FusionCore_Plugin::attributes('content-box-shortcode-icon-parent'), FusionCore_Plugin::attributes('content-box-shortcode-icon'));
}
}
if ($title) {
$title_output = sprintf('<h2 %s>%s</h2>', FusionCore_Plugin::attributes('content-box-heading'), $title);
}
if ((self::$parent_args['layout'] == 'icon-on-side' || self::$parent_args['layout'] == 'icon-with-title' || self::$parent_args['layout'] == 'timeline-vertical' || self::$parent_args['layout'] == 'clean-horizontal') && self::$parent_args['icon_align'] == 'right') {
$heading_content = $title_output . $icon_output;
} else {
$heading_content = $icon_output . $title_output;
}
if ($link) {
$heading_content = sprintf('<a %s %s>%s</a>', FusionCore_Plugin::attributes('heading-link'), FusionCore_Plugin::attributes('content-box-shortcode-link'), $heading_content);
}
if ($heading_content) {
$heading = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('content-box-shortcode-heading-wrapper'), $heading_content);
}
if ($link && $linktext) {
if (self::$parent_args['link_type'] == 'text' || self::$parent_args['link_type'] == 'button-bar') {
$link_output = sprintf('<div class="fusion-clearfix"></div><a %s %s>%s</a><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('fusion-read-more'), FusionCore_Plugin::attributes('content-box-shortcode-link'), $linktext);
} else {
if (self::$parent_args['link_type'] == 'button') {
$link_output = sprintf('<div class="fusion-clearfix"></div><a %s>%s</a><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('content-box-shortcode-link'), $linktext);
}
}
}
$content_output = sprintf('<div class="fusion-clearfix"></div><div %s>%s</div>', FusionCore_Plugin::attributes('content-box-shortcode-content-container'), do_shortcode($content) . $link_output);
$output = $heading . $content_output;
$timeline = '';
if ($icon && self::$parent_args['icon_circle'] == 'yes' && self::$parent_args['layout'] == 'timeline-horizontal' && self::$parent_args['columns'] != '1') {
$timeline = sprintf('<div %s></div>', FusionCore_Plugin::attributes('content-box-shortcode-timeline'));
}
if ($icon && self::$parent_args['icon_circle'] == 'yes' && self::$parent_args['layout'] == 'timeline-vertical') {
$timeline = sprintf('<div %s></div>', FusionCore_Plugin::attributes('content-box-shortcode-timeline'));
}
$html = sprintf('<div %s><div %s>%s%s</div></div>', FusionCore_Plugin::attributes('content-box-shortcode'), FusionCore_Plugin::attributes('content-box-shortcode-content-wrapper'), $output, $timeline);
$clearfix_test = $this->column_counter / $this->num_of_columns;
if (is_int($clearfix_test)) {
$html .= '<div class="fusion-clearfix"></div>';
}
$this->column_counter++;
return $html;
}
示例7: slide_link_attr
function slide_link_attr()
{
$attr = array();
if (self::$child_args['lightbox'] == 'yes') {
$attr['class'] = 'lightbox-enabled';
$attr['data-rel'] = sprintf('prettyPhoto[gallery_slider_%s]', $this->slider_counter);
}
$image_id = FusionCore_Plugin::get_attachment_id_from_url(self::$child_args['link']);
if (isset($image_id) && $image_id) {
$attr['data-caption'] = get_post_field('post_excerpt', $image_id);
$attr['data-title'] = get_post_field('post_title', $image_id);
}
$attr['href'] = self::$child_args['link'];
$attr['target'] = self::$child_args['linktarget'];
$attr['title'] = self::$child_args['title'];
return $attr;
}
示例8: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
global $smof_data;
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'align' => '', 'bordercolor' => '', 'borderradius' => $smof_data['imageframe_border_radius'], 'bordersize' => $smof_data['imageframe_border_size'], 'lightbox' => 'no', 'link' => '', 'linktarget' => '_self', 'style' => '', 'style_type' => 'none', 'stylecolor' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args);
if (!$defaults['style']) {
$defaults['style'] = $defaults['style_type'];
}
if ($defaults['borderradius'] && $defaults['style'] == 'bottomshadow') {
$defaults['borderradius'] = '0';
}
if ($defaults['borderradius'] == 'round') {
$defaults['borderradius'] = '50%';
}
extract($defaults);
self::$args = $defaults;
if (!$bordercolor) {
$bordercolor = $smof_data['imgframe_border_color'];
}
if (!$stylecolor) {
$stylecolor = $smof_data['imgframe_style_color'];
}
$rgb = FusionCore_Plugin::hex2rgb($stylecolor);
$styles = '';
if ($bordersize != '0' && $bordersize != '0px') {
$styles .= ".imageframe-{$this->imageframe_counter} img{border:{$bordersize} solid {$bordercolor};}";
}
if ($borderradius != '0' && $borderradius != '0px') {
$styles .= ".imageframe-{$this->imageframe_counter} img{-webkit-border-radius:{$borderradius};-moz-border-radius:{$borderradius};border-radius:{$borderradius};}";
}
if ($style == 'glow') {
$styles .= ".imageframe-{$this->imageframe_counter}.imageframe-glow img{\n\t\t\t\t-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\t-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\tbox-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t}";
}
if ($style == 'dropshadow') {
$styles .= ".imageframe-{$this->imageframe_counter}.imageframe-dropshadow img{\n\t\t\t\t-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\t-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\tbox-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t}";
}
if ($styles) {
$styles = sprintf('<style type="text/css">%s</style>', $styles);
} else {
$styles = '';
}
$html = sprintf('%s<span %s>', $styles, FusionCore_Plugin::attributes('imageframe-shortcode'));
preg_match('/(class=["\'](.*?)["\'])/', $content, $classes);
$class_style = '';
if ($style == 'circle') {
$class_style = ' img-circle';
}
if ($classes) {
$content = str_replace($classes[0], sprintf('class="img-responsive %s%s"', $classes[2], $class_style), $content);
} else {
$content = str_replace('/>', sprintf('class="img-responsive%s" />', $class_style), $content);
}
$alt_tag = $image_url = '';
preg_match('/(src=["\'](.*?)["\'])/', $content, $src);
$image_url = self::$args['pic_link'] = $src[2];
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image_url);
if (isset($image_id) && $image_id) {
$alt_tag = sprintf('alt="%s"', get_post_meta($image_id, '_wp_attachment_image_alt', true));
}
if (strpos($content, 'alt=""') !== false && $alt_tag) {
$content = str_replace('alt=""', $alt_tag, $content);
} elseif (strpos($content, 'alt') === false && $alt_tag) {
$content = str_replace('/> ', $alt_tag . ' />', $content);
}
$output = do_shortcode($content);
if ($lightbox == 'yes') {
self::$args['title_attr'] = '';
if ($image_id) {
self::$args['title_attr'] = get_post_field('post_excerpt', $image_id);
}
$output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content));
} elseif ($link) {
$output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content));
}
$html .= $output . '</span>';
if ($align == 'center') {
$html = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('imageframe-align-center'), $html);
}
$this->imageframe_counter++;
return $html;
}
示例9: render
/**
* Render the shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
global $smof_data;
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'align' => '', 'bordercolor' => '', 'borderradius' => $smof_data['imageframe_border_radius'], 'bordersize' => $smof_data['imageframe_border_size'], 'hide_on_mobile' => 'no', 'lightbox' => 'no', 'lightbox_image' => '', 'link' => '', 'linktarget' => '_self', 'style' => '', 'style_type' => 'none', 'stylecolor' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args);
if (!$defaults['style']) {
$defaults['style'] = $defaults['style_type'];
}
if ($defaults['borderradius'] && $defaults['style'] == 'bottomshadow') {
$defaults['borderradius'] = '0';
}
if ($defaults['borderradius'] == 'round') {
$defaults['borderradius'] = '50%';
}
extract($defaults);
self::$args = $defaults;
// Add the needed styles to the img tag
if (!$bordercolor) {
$bordercolor = $smof_data['imgframe_border_color'];
}
if (!$stylecolor) {
$stylecolor = $smof_data['imgframe_style_color'];
}
$rgb = FusionCore_Plugin::hex2rgb($stylecolor);
$img_styles = '';
if ($bordersize != '0' && $bordersize != '0px') {
$img_styles .= "border:{$bordersize} solid {$bordercolor};";
}
if ($borderradius != '0' && $borderradius != '0px') {
$img_styles .= "-webkit-border-radius:{$borderradius};-moz-border-radius:{$borderradius};border-radius:{$borderradius};";
}
if ($style == 'glow') {
$img_styles .= "-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);";
}
if ($style == 'dropshadow') {
$img_styles .= "-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);";
}
if ($img_styles) {
$img_styles = sprintf(' style="%s"', $img_styles);
}
$img_classes = 'img-responsive';
// Get custom classes from the img tag
preg_match('/(class=["\'](.*?)["\'])/', $content, $classes);
if (!empty($classes)) {
$img_classes .= ' ' . $classes[2];
}
$img_classes = sprintf('class="%s"', $img_classes);
// Add custom and responsive class and the needed styles to the img tag
if (!empty($classes)) {
$content = str_replace($classes[0], $img_classes . $img_styles, $content);
} else {
$content = str_replace('/>', $img_classes . $img_styles . '/>', $content);
}
// Alt tag
$alt_tag = $image_url = '';
preg_match('/(src=["\'](.*?)["\'])/', $content, $src);
if (array_key_exists('2', $src)) {
$image_url = self::$args['pic_link'] = $src[2];
$image_id = FusionCore_Plugin::get_attachment_id_from_url($image_url);
if (isset($image_id) && $image_id) {
$alt_tag = sprintf('alt="%s"', get_post_field('_wp_attachment_image_alt', $image_id));
}
if (strpos($content, 'alt=""') !== false && $alt_tag) {
$content = str_replace('alt=""', $alt_tag, $content);
} elseif (strpos($content, 'alt') === false && $alt_tag) {
$content = str_replace('/> ', $alt_tag . ' />', $content);
}
}
// Set the lightbox image to the dedicated linkm if it is set
if ($lightbox_image) {
self::$args['pic_link'] = $lightbox_image;
}
$output = do_shortcode($content);
if ($lightbox == 'yes') {
self::$args['data_caption'] = '';
self::$args['data_title'] = '';
if ($image_id) {
self::$args['data_caption'] = get_post_field('post_excerpt', $image_id);
self::$args['data_title'] = get_post_field('post_title', $image_id);
}
$output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content));
} elseif ($link) {
$output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content));
}
$html = sprintf('<span %s>%s</span>', FusionCore_Plugin::attributes('imageframe-shortcode'), $output);
if ($align == 'center') {
$html = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('imageframe-align-center'), $html);
}
$this->imageframe_counter++;
return $html;
}
示例10: render_child_clean
private function render_child_clean($content)
{
$thumbnail = $pic = $author = '';
if (self::$child_args['avatar'] == 'image' && self::$child_args['image']) {
$image_id = FusionCore_Plugin::get_attachment_id_from_url(self::$child_args['image']);
self::$child_args['alt'] = '';
if ($image_id) {
self::$child_args['alt'] = get_post_field('post_excerpt', $image_id);
}
$pic = sprintf('<img %s />', FusionCore_Plugin::attributes('testimonials-shortcode-image'));
}
if (self::$child_args['avatar'] == 'image' && !self::$child_args['image']) {
self::$child_args['avatar'] = 'none';
}
if (self::$child_args['avatar'] != 'none') {
$thumbnail = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('testimonials-shortcode-thumbnail'), $pic);
}
$author .= sprintf('<div %s><span %s><strong>%s</strong>', FusionCore_Plugin::attributes('testimonials-shortcode-author'), FusionCore_Plugin::attributes('company-name'), self::$child_args['name']);
if (self::$child_args['company']) {
if (!empty(self::$child_args['link']) && self::$child_args['link']) {
$author .= sprintf(', <a href="%s" target="%s">%s</a>', self::$child_args['link'], self::$child_args['target'], sprintf('<span>%s</span>', self::$child_args['company']));
} else {
$author .= sprintf(', <span>%s</span>', self::$child_args['company']);
}
}
$author .= '</span></div>';
$html = sprintf('<div %s>%s<blockquote %s><q %s>%s</q></blockquote>%s</div>', FusionCore_Plugin::attributes('testimonials-shortcode-review'), $thumbnail, FusionCore_Plugin::attributes('testimonials-shortcode-blockquote'), FusionCore_Plugin::attributes('testimonials-shortcode-quote'), do_shortcode($content), $author);
return $html;
}
示例11: slide_link_attr
function slide_link_attr()
{
$attr = array();
if (self::$parent_args['lightbox'] == 'yes') {
if (!self::$child_args['link']) {
self::$child_args['link'] = self::$child_args['image'];
}
$attr['data-rel'] = sprintf('iLightbox[gallery_image_%s]', $this->image_carousel_counter);
$image_id = FusionCore_Plugin::get_attachment_id_from_url(self::$child_args['image']);
$attr['data-caption'] = get_post_field('post_excerpt', $image_id);
$attr['data-title'] = get_post_field('post_title', $image_id);
}
$attr['href'] = self::$child_args['link'];
$attr['target'] = self::$child_args['linktarget'];
return $attr;
}