本文整理汇总了PHP中FusionCore_Plugin::hex2rgb方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCore_Plugin::hex2rgb方法的具体用法?PHP FusionCore_Plugin::hex2rgb怎么用?PHP FusionCore_Plugin::hex2rgb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionCore_Plugin
的用法示例。
在下文中一共展示了FusionCore_Plugin::hex2rgb方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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' => '', 'animation' => 'no', 'address' => '', 'height' => '300px', 'icon' => '', 'infobox' => '', 'infobox_background_color' => '', 'infobox_content' => '', 'infobox_text_color' => '', 'map_style' => '', 'overlay_color' => '', 'popup' => 'yes', 'scale' => 'yes', 'scrollwheel' => 'yes', 'type' => 'roadmap', 'width' => '100%', 'zoom' => '14', 'zoom_pancontrol' => 'yes'), $args);
extract($defaults);
self::$args = $defaults;
$html = '';
if ($address) {
$addresses = explode('|', $address);
if ($addresses) {
self::$args['address'] = $addresses;
}
$num_of_addresses = count($addresses);
if ($infobox_content) {
$infobox_content_array = explode('|', $infobox_content);
} else {
$infobox_content_array = '';
}
if ($icon) {
$icon_array = explode('|', $icon);
} else {
$icon_array = '';
}
if ($map_style == 'theme') {
$map_style = 'custom';
$icon = 'theme';
$animation = 'yes';
$infobox = 'custom';
$infobox_background_color = FusionCore_Plugin::hex2rgb($smof_data['primary_color']);
$infobox_background_color = 'rgba(' . $infobox_background_color[0] . ', ' . $infobox_background_color[1] . ', ' . $infobox_background_color[2] . ', 0.8)';
$overlay_color = $smof_data['primary_color'];
$brightness_level = FusionCore_Plugin::calc_color_brightness($smof_data['primary_color']);
if ($brightness_level > 140) {
$infobox_text_color = '#fff';
} else {
$infobox_text_color = '#747474';
}
}
// If only one custom icon is set, use it for all markers
if ($map_style == 'custom' && $icon && $icon != 'theme' && $icon_array && count($icon_array) == 1) {
$icon_url = $icon_array[0];
for ($i = 0; $i < $num_of_addresses; $i++) {
$icon_array[$i] = $icon_url;
}
}
if ($icon == 'theme' && $map_style == 'custom') {
for ($i = 0; $i < $num_of_addresses; $i++) {
$icon_array[$i] = plugins_url('images/avada_map_marker.png', dirname(__FILE__));
}
}
if (wp_script_is('google-maps-api', 'registered')) {
wp_print_scripts('google-maps-api');
}
if (wp_script_is('google-maps-infobox', 'registered')) {
wp_print_scripts('google-maps-infobox');
}
foreach (self::$args['address'] as $add) {
$add = trim($add);
$add_arr = explode("\n", $add);
$add_arr = array_filter($add_arr, 'trim');
$add = implode('<br/>', $add_arr);
$add = str_replace("\r", '', $add);
$add = str_replace("\n", '', $add);
$coordinates[]['address'] = $add;
}
if (!is_array($coordinates)) {
return;
}
for ($i = 0; $i < $num_of_addresses; $i++) {
if (strpos(self::$args['address'][$i], 'latlng=') === 0) {
self::$args['address'][$i] = $coordinates[$i]['address'];
}
}
if (is_array($infobox_content_array) && !empty($infobox_content_array)) {
for ($i = 0; $i < $num_of_addresses; $i++) {
if (!array_key_exists($i, $infobox_content_array)) {
$infobox_content_array[$i] = self::$args['address'][$i];
}
}
self::$args['infobox_content'] = $infobox_content_array;
} else {
self::$args['infobox_content'] = self::$args['address'];
}
$cached_addresses = get_option('fusion_map_addresses');
foreach (self::$args['address'] as $key => $address) {
$json_addresses[] = array('address' => $address, 'infobox_content' => html_entity_decode(self::$args['infobox_content'][$key]));
if (isset($icon_array) && is_array($icon_array) && array_key_exists($key, $icon_array)) {
$json_addresses[$key]['marker'] = $icon_array[$key];
}
if (strpos($address, strtolower('latlng=')) !== false) {
$json_addresses[$key]['address'] = str_replace('latlng=', '', $address);
$latLng = explode(',', $json_addresses[$key]['address']);
$json_addresses[$key]['coordinates'] = true;
$json_addresses[$key]['latitude'] = $latLng[0];
//.........这里部分代码省略.........
示例2: 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' => '', 'lightbox' => 'no', 'linktarget' => '_self', 'name' => '', 'social_icon_boxed' => strtolower($smof_data['social_links_boxed']), 'social_icon_boxed_colors' => strtolower($smof_data['social_links_box_color']), 'social_icon_boxed_radius' => strtolower($smof_data['social_links_boxed_radius']), 'social_icon_colors' => strtolower($smof_data['social_links_icon_color']), 'social_icon_order' => '', 'social_icon_tooltip' => strtolower($smof_data['social_links_tooltip_placement']), 'pic_bordercolor' => strtolower($smof_data['person_border_color']), 'pic_bordersize' => strtolower($smof_data['person_border_size']), 'pic_link' => '', 'pic_style' => 'none', 'pic_style_color' => strtolower($smof_data['person_style_color']), 'picture' => '', 'title' => '', 'facebook' => '', 'twitter' => '', 'instagram' => '', 'linkedin' => '', 'dribbble' => '', 'rss' => '', 'youtube' => '', 'pinterest' => '', 'flickr' => '', 'vimeo' => '', 'tumblr' => '', 'google' => '', 'googleplus' => '', 'digg' => '', 'blogger' => '', 'skype' => '', 'myspace' => '', 'deviantart' => '', 'yahoo' => '', 'reddit' => '', 'forrst' => '', 'paypal' => '', 'dropbox' => '', 'soundcloud' => '', 'vk' => '', 'email' => ''), $args);
extract($defaults);
self::$args = $defaults;
if ($smof_data['social_icons_new']) {
self::$args['linktarget'] == '_blank';
} else {
self::$args['linktarget'] == '_self';
}
self::$args['styles'] = '';
$rgb = FusionCore_Plugin::hex2rgb($defaults['pic_style_color']);
if ($pic_style == 'glow') {
self::$args['styles'] .= "-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);";
}
if ($pic_style == 'dropshadow') {
self::$args['styles'] .= "\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);";
}
$inner_content = '';
if ($picture) {
$picture = sprintf('<img %s />', FusionCore_Plugin::attributes('person-shortcode-img'));
if ($pic_link) {
$picture = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('person-shortcode-href'), $picture);
}
$picture = sprintf('<div %s><div %s>%s</div></div>', FusionCore_Plugin::attributes('person-shortcode-image-wrapper'), FusionCore_Plugin::attributes('person-shortcode-image-container'), $picture);
}
if ($name || $title || $content) {
$social_networks = $this->get_social_links_array();
if (!is_array($social_icon_order)) {
$social_icon_order = explode('|', $social_icon_order);
}
//$social_networks = FusionCore_Plugin::order_array_like_array( $social_networks, $social_icon_order );
$social_icon_colors = explode('|', $social_icon_colors);
$num_of_icon_colors = count($social_icon_colors);
$social_icon_boxed_colors = explode('|', $social_icon_boxed_colors);
$num_of_box_colors = count($social_icon_boxed_colors);
$icons = '';
if (isset($smof_data['social_sorter']) && $smof_data['social_sorter']) {
$order = $smof_data['social_sorter'];
$ordered_array = explode(',', $order);
if (isset($ordered_array) && $ordered_array && is_array($ordered_array)) {
$social_networks_old = $social_networks;
$social_networks = array();
foreach ($ordered_array as $key => $field_order) {
$field_order_number = str_replace('social_sorter_', '', $field_order);
$find_the_field = $smof_data['social_sorter_' . $field_order_number];
$field_name = str_replace('_link', '', $smof_data['social_sorter_' . $field_order_number]);
if ($field_name == 'google') {
$field_name = 'googleplus';
} elseif ($field_name == 'email') {
$field_name = 'mail';
}
if (!isset($social_networks_old[$field_name])) {
continue;
}
$social_networks[$field_name] = $social_networks_old[$field_name];
}
}
}
for ($i = 0; $i < count($social_networks); $i++) {
if ($num_of_icon_colors == 1) {
$social_icon_colors[$i] = $social_icon_colors[0];
}
if ($num_of_box_colors == 1) {
$social_icon_boxed_colors[$i] = $social_icon_boxed_colors[0];
}
}
$i = 0;
foreach ($social_networks as $network => $link) {
$icon_options = array('social_network' => $network, 'social_link' => $link, 'icon_color' => $i < count($social_icon_colors) ? $social_icon_colors[$i] : '', 'box_color' => $i < count($social_icon_boxed_colors) ? $social_icon_boxed_colors[$i] : '');
$icons .= sprintf('<a %s></a>', FusionCore_Plugin::attributes('person-shortcode-icon', $icon_options));
$i++;
}
$inner_content .= sprintf('<div %s><div %s><div %s><span %s>%s</span><span %s>%s</span></div><div %s>%s</div></div><div %s>%s</div></div>', FusionCore_Plugin::attributes('person-desc'), FusionCore_Plugin::attributes('person-shortcode-author'), FusionCore_Plugin::attributes('person-author-wrapper'), FusionCore_Plugin::attributes('person-name'), $name, FusionCore_Plugin::attributes('person-title'), $title, FusionCore_Plugin::attributes('person-shortcode-social-networks'), $icons, FusionCore_Plugin::attributes('person-content fusion-clearfix'), do_shortcode($content));
}
$html = sprintf('<div %s>%s%s</div>', FusionCore_Plugin::attributes('person-shortcode'), $picture, $inner_content);
return $html;
}
示例3: 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' => '', 'animation' => 'no', 'address' => '', 'height' => '300px', 'icon' => '', 'infobox' => '', 'infobox_background_color' => '', 'infobox_content' => '', 'infobox_text_color' => '', 'map_style' => '', 'overlay_color' => '', 'popup' => 'yes', 'scale' => 'yes', 'scrollwheel' => 'yes', 'type' => 'roadmap', 'width' => '100%', 'zoom' => '14', 'zoom_pancontrol' => 'yes'), $args);
extract($defaults);
self::$args = $defaults;
$html = '';
if ($address) {
$addresses = explode('|', $address);
if ($infobox_content) {
$infobox_content_array = explode('|', $infobox_content);
} else {
$infobox_content_array = '';
}
if ($icon) {
$icon_array = explode('|', $icon);
} else {
$icon_array = '';
}
if ($addresses) {
self::$args['address'] = $addresses;
}
$num_of_addresses = count($addresses);
if ($map_style == 'theme') {
$map_style = 'custom';
$icon = 'theme';
$animation = 'yes';
$infobox = 'custom';
$infobox_background_color = FusionCore_Plugin::hex2rgb($smof_data['primary_color']);
$infobox_background_color = 'rgba(' . $infobox_background_color[0] . ', ' . $infobox_background_color[1] . ', ' . $infobox_background_color[2] . ', 0.8)';
$overlay_color = $smof_data['primary_color'];
$brightness_level = FusionCore_Plugin::calc_color_brightness($smof_data['primary_color']);
if ($brightness_level > 140) {
$infobox_text_color = '#fff';
} else {
$infobox_text_color = '#747474';
}
}
if ($map_style == 'custom') {
$animation = 'yes';
}
if ($icon == 'theme' && $map_style == 'custom') {
for ($i = 0; $i < $num_of_addresses; $i++) {
$icon_array[$i] = plugins_url('images/avada_map_marker.png', dirname(__FILE__));
}
}
wp_print_scripts('google-maps-api');
wp_print_scripts('google-maps-infobox');
foreach (self::$args['address'] as $add) {
$coordinates[] = $this->get_coordinates($add);
}
if (!is_array($coordinates)) {
return;
}
for ($i = 0; $i < $num_of_addresses; $i++) {
if (strpos(self::$args['address'][$i], 'latlng=') === 0) {
self::$args['address'][$i] = $coordinates[$i]['address'];
}
}
if (is_array($infobox_content_array) && !empty($infobox_content_array)) {
for ($i = 0; $i < $num_of_addresses; $i++) {
if (!array_key_exists($i, $infobox_content_array)) {
$infobox_content_array[$i] = self::$args['address'][$i];
}
}
self::$args['infobox_content'] = $infobox_content_array;
} else {
self::$args['infobox_content'] = self::$args['address'];
}
$map_id = uniqid('fusion_map_');
// generate a unique ID for this map
$this->map_id = $map_id;
ob_start();
?>
<script type="text/javascript">
var map_<?php
echo $map_id;
?>
;
var markers = [];
var counter = 0;
function fusion_run_map_<?php
echo $map_id;
?>
() {
var location = new google.maps.LatLng(<?php
echo $coordinates[0]['lat'];
?>
, <?php
echo $coordinates[0]['lng'];
?>
);
var map_options = {
zoom: <?php
//.........这里部分代码省略.........
示例4: render_parent
//.........这里部分代码省略.........
}
if (isset($metadata['pyre_loop_video'][0]) && $metadata['pyre_loop_video'][0] == 'yes') {
$video_attributes .= ' loop';
$youtube_attributes .= '&loop=1&playlist=' . $metadata['pyre_youtube_id'][0];
$vimeo_attributes .= '&loop=1';
$data_loop = 'yes';
}
if (isset($metadata['pyre_hide_video_controls'][0]) && $metadata['pyre_hide_video_controls'][0] == 'no') {
$video_attributes .= ' controls';
$youtube_attributes .= '&controls=1';
$video_zindex = 'z-index: 1;';
} else {
$youtube_attributes .= '&controls=0';
$video_zindex = 'z-index: -99;';
}
$heading_color = '';
if (isset($metadata['pyre_heading_color'][0]) && $metadata['pyre_heading_color'][0]) {
$heading_color = 'color:' . $metadata['pyre_heading_color'][0] . ';';
}
$heading_bg = '';
if (isset($metadata['pyre_heading_bg'][0]) && $metadata['pyre_heading_bg'][0] == 'yes') {
$heading_bg = 'background-color: rgba(0,0,0, 0.4);';
}
$caption_color = '';
if (isset($metadata['pyre_caption_color'][0]) && $metadata['pyre_caption_color'][0]) {
$caption_color = 'color:' . $metadata['pyre_caption_color'][0] . ';';
}
$caption_bg = '';
if (isset($metadata['pyre_caption_bg'][0]) && $metadata['pyre_caption_bg'][0] == 'yes') {
$caption_bg = 'background-color: rgba(0, 0, 0, 0.4);';
}
$video_bg_color = '';
if (isset($metadata['pyre_video_bg_color'][0]) && $metadata['pyre_video_bg_color'][0]) {
$video_bg_color_hex = FusionCore_Plugin::hex2rgb($metadata['pyre_video_bg_color'][0]);
$video_bg_color = 'background-color: rgba(' . $video_bg_color_hex[0] . ', ' . $video_bg_color_hex[1] . ', ' . $video_bg_color_hex[2] . ', 0.4);';
}
$video = false;
if (isset($metadata['pyre_type'][0])) {
if (isset($metadata['pyre_type'][0]) && $metadata['pyre_type'][0] == 'self-hosted-video' || $metadata['pyre_type'][0] == 'youtube' || $metadata['pyre_type'][0] == 'vimeo') {
$video = true;
}
}
if (isset($metadata['pyre_type'][0]) && $metadata['pyre_type'][0] == 'self-hosted-video') {
$background_class = 'self-hosted-video-bg';
}
$heading_font_size = 'font-size:60px;line-height:80px;';
if (isset($metadata['pyre_heading_font_size'][0]) && $metadata['pyre_heading_font_size'][0]) {
$line_height = $metadata['pyre_heading_font_size'][0] * 1.4;
$heading_font_size = 'font-size:' . $metadata['pyre_heading_font_size'][0] . 'px;line-height:' . $line_height . 'px;';
}
$caption_font_size = 'font-size: 24px;line-height:38px;';
if (isset($metadata['pyre_caption_font_size'][0]) && $metadata['pyre_caption_font_size'][0]) {
$line_height = $metadata['pyre_caption_font_size'][0] * 1.4;
$caption_font_size = 'font-size:' . $metadata['pyre_caption_font_size'][0] . 'px;line-height:' . $line_height . 'px;';
}
?>
<li data-mute="<?php
echo $data_mute;
?>
" data-loop="<?php
echo $data_loop;
?>
" data-autoplay="<?php
echo $data_autoplay;
?>
">
示例5: 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;
}
示例6: 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;
}
示例7: attr
function attr()
{
global $smof_data;
$attr = array();
$attr['style'] = '';
$bordercolor = self::$args['bordercolor'];
$stylecolor = self::$args['stylecolor'];
$bordersize = self::$args['bordersize'];
$borderradius = self::$args['borderradius'];
$style = self::$args['style'];
// 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) {
$attr['style'] .= $img_styles;
}
$attr['class'] = sprintf('fusion-imageframe imageframe-%s imageframe-%s', self::$args['style'], $this->imageframe_counter);
if (self::$args['style'] == 'bottomshadow') {
$attr['class'] .= ' element-bottomshadow';
}
if (self::$args['align'] == 'left') {
$attr['style'] .= 'margin-right:25px;float:left;';
} elseif (self::$args['align'] == 'right') {
$attr['style'] .= 'margin-left:25px;float:right;';
}
if (self::$args['hover_type'] != 'liftup') {
$attr['class'] .= ' hover-type-' . self::$args['hover_type'];
}
if (self::$args['class']) {
$attr['class'] .= ' ' . self::$args['class'];
}
if (self::$args['id']) {
$attr['id'] = self::$args['id'];
}
if (self::$args['animation_type']) {
$animations = FusionCore_Plugin::animations(array('type' => self::$args['animation_type'], 'direction' => self::$args['animation_direction'], 'speed' => self::$args['animation_speed']));
$attr = array_merge($attr, $animations);
$attr['class'] .= ' ' . $attr['animation_class'];
unset($attr['animation_class']);
}
if (self::$args['hide_on_mobile'] == 'yes') {
$attr['class'] .= ' fusion-hide-on-mobile';
}
return $attr;
}