<?php if ($post_data['post_video']) { echo trim(axiom_get_video_frame($post_data['post_video'], $post_data['post_video_image'] ? $post_data['post_video_image'] : $post_data['post_thumb'])); } else { if ($post_data['post_audio']) { echo trim(axiom_get_audio_frame($post_data['post_audio'], $post_data['post_audio_image'] ? $post_data['post_audio_image'] : $post_data['post_thumb_url'])); } else { if ($post_data['post_thumb'] && ($post_data['post_format'] != 'gallery' || !$post_data['post_gallery'] || axiom_get_custom_option('gallery_instead_image') == 'no')) { ?> <div class="post_thumb" data-image="<?php echo esc_url($post_data['post_attachment']); ?> " data-title="<?php echo esc_attr($post_data['post_title']); ?> "> <?php if ($post_data['post_format'] == 'link' && $post_data['post_url'] != '') { echo '<a class="hover_icon hover_icon_link" href="' . esc_url($post_data['post_url']) . '"' . ($post_data['post_url_target'] ? ' target="' . esc_attr($post_data['post_url_target']) . '"' : '') . '>' . $post_data['post_thumb'] . '</a>'; } else { if ($post_data['post_link'] != '') { echo '<a class="hover_icon hover_icon_link" href="' . esc_url($post_data['post_link']) . '">' . $post_data['post_thumb'] . '</a>'; } else { echo trim($post_data['post_thumb']); } } ?> </div> <?php } else {
function axiom_sc_audio($atts, $content = null) { if (axiom_sc_in_shortcode_blogger()) { return ''; } extract(axiom_sc_html_decode(shortcode_atts(array("title" => "", "author" => "", "image" => "", "mp3" => '', "wav" => '', "src" => '', "url" => '', "align" => '', "controls" => "", "autoplay" => "", "frame" => "on", "id" => "", "class" => "", "css" => "", "animation" => "", "width" => '', "height" => '', "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts))); if ($src == '' && $url == '' && isset($atts[0])) { $src = $atts[0]; } if ($src == '') { if ($url) { $src = $url; } else { if ($mp3) { $src = $mp3; } else { if ($wav) { $src = $wav; } } } } if ($image > 0) { $attach = wp_get_attachment_image_src($image, 'full'); if (isset($attach[0]) && $attach[0] != '') { $image = $attach[0]; } } $css .= axiom_get_css_position_from_values($top, $right, $bottom, $left); $data = ($title != '' ? ' data-title="' . esc_attr($title) . '"' : '') . ($author != '' ? ' data-author="' . esc_attr($author) . '"' : '') . ($image != '' ? ' data-image="' . esc_url($image) . '"' : '') . ($align && $align != 'none' ? ' data-align="' . esc_attr($align) . '"' : '') . (!axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : ''); $audio = '<audio' . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="sc_audio' . (!empty($class) ? ' ' . esc_attr($class) : '') . '"' . ' src="' . esc_url($src) . '"' . (axiom_sc_param_is_on($controls) ? ' controls="controls"' : '') . (axiom_sc_param_is_on($autoplay) && is_single() ? ' autoplay="autoplay"' : '') . ' width="' . esc_attr($width) . '" height="' . esc_attr($height) . '"' . ($css != '' ? ' style="' . esc_attr($css) . '"' : '') . $data . '></audio>'; if (axiom_get_custom_option('substitute_audio') == 'no') { if (axiom_sc_param_is_on($frame)) { $audio = axiom_get_audio_frame($audio, $image, $s); } } else { if (isset($_GET['vc_editable']) && $_GET['vc_editable'] == 'true' && (isset($_POST['action']) && $_POST['action'] == 'vc_load_shortcode')) { $audio = axiom_substitute_audio($audio, false); } } if (axiom_get_theme_option('use_mediaelement') == 'yes') { axiom_enqueue_script('wp-mediaelement'); } return apply_filters('axiom_shortcode_output', $audio, 'trx_audio', $atts, $content); }
function axiom_substitute_audio($post_text, $in_frame = true) { $tag = '<audio>'; $tag_end = '</audio>'; $pos_start = -1; while (($pos_start = axiom_strpos($post_text, axiom_substr($tag, 0, -1) . ' ', $pos_start + 1)) !== false) { $pos_end = axiom_strpos($post_text, axiom_substr($tag, -1), $pos_start); $pos_end2 = axiom_strpos($post_text, $tag_end, $pos_end); $tag_text = axiom_substr($post_text, $pos_start, ($pos_end2 !== false ? $pos_end2 + 7 : $pos_end) - $pos_start + 1); if (($src = axiom_get_tag_attrib($tag_text, $tag, 'src')) == '') { $src = axiom_get_tag_attrib($tag_text, $tag, 'url'); } if ($src != '') { $id = axiom_get_tag_attrib($tag_text, $tag, 'id'); $tag_w = axiom_get_tag_attrib($tag_text, $tag, 'width'); $tag_h = axiom_get_tag_attrib($tag_text, $tag, 'height'); $tag_a = axiom_get_tag_attrib($tag_text, $tag, 'align'); if (!$tag_a) { $tag_a = axiom_get_tag_attrib($tag_text, $tag, 'data-align'); } $tag_s = axiom_get_tag_attrib($tag_text, $tag, 'style') . ($tag_w != '' ? 'width:' . esc_attr($tag_w) . (axiom_substr($tag_w, -1) != '%' ? 'px' : '') . ';' : '') . ($tag_h != '' ? 'height:' . esc_attr($tag_h) . 'px;' : ''); $pos_end = $pos_end2 !== false ? $pos_end2 + 8 : $pos_end + 1; $tag_text = '<div' . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="sc_audio_container' . (!$in_frame && $tag_a ? ' align' . esc_attr($tag_a) : '') . '">' . (axiom_strpos($src, 'soundcloud.com') !== false ? '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="' . esc_url('https://w.soundcloud.com/player/?url=' . $src) . '"></iframe>' : $tag_text) . '</div>'; if ($in_frame) { $tag_image = axiom_get_tag_attrib($tag_text, $tag, 'data-image'); $tag_text = axiom_get_audio_frame($tag_text, $tag_image, $tag_s); } $post_text = axiom_substr($post_text, 0, axiom_substr($post_text, $pos_start - 3, 3) == '<p>' ? $pos_start - 3 : $pos_start) . $tag_text . axiom_substr($post_text, axiom_substr($post_text, $pos_end, 4) == '</p>' ? $pos_end + 4 : $pos_end); $pos_start += axiom_strlen($tag_text); $pos_start = min($pos_start, axiom_strlen($post_text) - 2); } } return $post_text; }