コード例 #1
1
/**
* We're going to override the_content through a filter.
*/
function cap_podcast_player($id = null, $player_type = 'default')
{
    if (empty($id)) {
        $post_id = get_the_ID();
    } else {
        $post_id = $id;
    }
    $episode_number = get_post_meta($post_id, 'episode_number', true);
    // Get Episode Media Source
    $episode_attachment_id = get_post_meta($post_id, 'episode_file', true);
    $episode_external_file = get_post_meta($post_id, 'external_episode_file', true);
    if (!empty($episode_attachment_id)) {
        $player_src = wp_get_attachment_url($episode_attachment_id);
    } elseif (!empty($episode_external_file)) {
        $player_src = $episode_external_file;
    }
    $attr = array('src' => '' . $player_src . '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata');
    $player = wp_audio_shortcode($attr);
    $download_link = '<small><a href="' . $player_src . '" download="episode' . $episode_number . '.mp3">Download this Episode</a></small>';
    // Get Episode Artwork //
    $episode_artwork_id = get_post_thumbnail_id($post_id);
    $episode_artwork = wp_get_attachment_image_src($episode_artwork_id, 'cap-podcast-thumbnail');
    $episode_artwork_src = $episode_artwork[0];
    if ('default' == $player_type) {
        $episode_title = '
        <div class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
        </div>
        ';
    } elseif ('large' == $player_type) {
        $post_object = get_post($post_id);
        $episode_title = '
        <a href="' . get_permalink($post_id) . '" class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
            <span class="description">' . wp_trim_words($post_object->post_content, '60') . '</span>
        </a>
        ';
    } elseif ('mini' == $player_type) {
        $episode_title = '';
    }
    // Construct Markup
    $markup = '
    <div class="episode-header">
        <div class="episode-artwork-container">
            <div class="episode-artwork" style="background-image: url(' . $episode_artwork_src . ');">
                <div id="play-episode" class="maintain-ratio">
                    <span class="dashicons"></span>
                </div>
            </div>
        </div>
        ' . $episode_title . '
    </div>';
    $script = "\n    <script type='text/javascript'>\n    var playerID = jQuery('#episode-" . $episode_number . "-" . $post_id . " audio').attr('id');\n    var player" . $post_id . " = document.getElementById(playerID);\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function(){\n        jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').toggleClass('paused');\n    });\n\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function() {\n\n        if ( jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".play();\n        }\n\n        if ( !jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".pause();\n        }\n\n    });\n    </script>\n    ";
    if (function_exists('cap_podcast_player_colors')) {
        $player .= cap_podcast_player_colors($post_id);
    }
    return '<div id="episode-' . $episode_number . '-' . $post_id . '" class="podcast-player ' . $player_type . '">' . $markup . $player . $download_link . $script . '</div>';
}
コード例 #2
0
ファイル: test-sanitize.php プロジェクト: cumi/pressbooks
 /**
  * @covers \PressBooks\Sanitize\fix_audio_shortcode
  */
 public function test_fix_audio_shortcode()
 {
     \PressBooks\Sanitize\fix_audio_shortcode();
     $this->assertTrue(has_filter('wp_audio_shortcode'));
     // Verify that style attribute is empty.
     $var = wp_audio_shortcode(array('src' => 'http://foo/audio.mp3'));
     $this->assertContains('style=""', $var);
 }
コード例 #3
0
 public function get_html($media)
 {
     if (!$media) {
         return '';
     }
     $html = '';
     $args = array('src' => mpp_get_media_src(), 'loop' => false, 'autoplay' => false);
     return wp_audio_shortcode($args);
 }
コード例 #4
0
ファイル: functions.php プロジェクト: TyRichards/paradox
/**
 * This will add portfolio media content to the start of the content
 * Override this functionality in a theme by removing the filter.
 * 
 * @param  string $content The content
 * @return string          The updated content
 */
function tzp_add_portfolio_post_media($content)
{
    global $post;
    if ($post->post_type == 'portfolio') {
        $display_gallery = get_post_meta($post->ID, '_tzp_display_gallery', true);
        $display_audio = get_post_meta($post->ID, '_tzp_display_audio', true);
        $display_video = get_post_meta($post->ID, '_tzp_display_video', true);
        if ($display_gallery || $display_audio || $display_video) {
            $output = '<div class="portfolio-media">';
            if ($display_gallery) {
                $output .= tzp_portfolio_gallery($post->ID);
            }
            if ($display_audio) {
                $poster = get_post_meta($post->ID, '_tzp_audio_poster_url', true);
                if ($poster) {
                    $output .= sprintf('<img src="%1$s" alt="" />', esc_url($poster));
                }
                $mp3 = get_post_meta($post->ID, '_tzp_audio_file_mp3', true);
                $ogg = get_post_meta($post->ID, '_tzp_audio_file_ogg', true);
                $attr = array('mp3' => $mp3, 'ogg' => $ogg);
                $output .= wp_audio_shortcode($attr);
            }
            if ($display_video) {
                $embed = get_post_meta($post->ID, '_tzp_video_embed', true);
                if ($embed) {
                    $output .= html_entity_decode(esc_html($embed));
                } else {
                    $poster = get_post_meta($post->ID, '_tzp_video_poster_url', true);
                    $m4v = get_post_meta($post->ID, '_tzp_video_file_m4v', true);
                    $ogv = get_post_meta($post->ID, '_tzp_video_file_ogv', true);
                    $mp4 = get_post_meta($post->ID, '_tzp_video_file_mp4', true);
                    $attr = array('poster' => $poster, 'm4v' => $m4v, 'ogv' => $ogv, 'mp4' => $mp4);
                    $output .= wp_video_shortcode($attr);
                }
            }
            $output .= '</div>';
            return $output . $content;
        }
        return $content;
    } else {
        return $content;
    }
}
コード例 #5
0
    public static function front_main($data)
    {
        $data->name = __CLASS__;
        ?>
		<div id="module-<?php 
        echo $data->ID;
        ?>
" class="<?php 
        echo $data->name;
        ?>
 front-single-module<?php 
        echo audio_module::FRONT_SAVE == true ? '-save' : '';
        ?>
">
			<?php 
        if ($data->post_title != '' && parent::display_title_on_front($data)) {
            ?>
				<h2 class="module_title"><?php 
            echo $data->post_title;
            ?>
</h2>
			<?php 
        }
        ?>

			<?php 
        if ($data->audio_url != '') {
            ?>
				<div class="audio_player">
					<?php 
            $attr = array('src' => $data->audio_url, 'loop' => checked($data->loop, 'Yes', false) ? 'on' : '', 'autoplay' => checked($data->autoplay, 'Yes', false) ? 'on' : '');
            echo wp_audio_shortcode($attr);
            ?>
				</div>
			<?php 
        }
        ?>
		</div>
	<?php 
    }
コード例 #6
0
ファイル: fileupload.php プロジェクト: psdes/GravityView
 /**
  * Return an array of files prepared for output.
  *
  * Processes files by file type and generates unique output for each.
  *
  * Returns array for each file, with the following keys:
  *
  * `file_path` => The file path of the file, with a line break
  * `html` => The file output HTML formatted
  *
  * @since  1.2
  * @todo  Support `playlist` shortcode for playlist of video/audio
  * @usedby gravityview_get_files_array()
  * @param  string $value    Field value passed by Gravity Forms. String of file URL, or serialized string of file URL array
  * @param  string $gv_class Field class to add to the output HTML
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
  */
 static function get_files_array($value, $gv_class)
 {
     $gravityview_view = GravityView_View::getInstance();
     extract($gravityview_view->getCurrentField());
     $output_arr = array();
     // Get an array of file paths for the field.
     $file_paths = rgar($field, 'multipleFiles') ? json_decode($value) : array($value);
     // Process each file path
     foreach ($file_paths as $file_path) {
         // If the site is HTTPS, use HTTPS
         if (function_exists('set_url_scheme')) {
             $file_path = set_url_scheme($file_path);
         }
         // This is from Gravity Forms's code
         $file_path = esc_attr(str_replace(" ", "%20", $file_path));
         // If the field is set to link to the single entry, link to it.
         $link = !empty($field_settings['show_as_link']) ? GravityView_API::entry_link($entry, $field) : $file_path;
         // Get file path information
         $file_path_info = pathinfo($file_path);
         $html_format = NULL;
         $disable_lightbox = false;
         $disable_wrapped_link = false;
         // Is this an image?
         $image = new GravityView_Image(array('src' => $file_path, 'class' => 'gv-image gv-field-id-' . $field_settings['id'], 'alt' => $field_settings['label'], 'width' => gravityview_get_context() === 'single' ? NULL : 250));
         $content = $image->html();
         // The new default content is the image, if it exists. If not, use the file name as the content.
         $content = !empty($content) ? $content : $file_path_info['basename'];
         // If pathinfo() gave us the extension of the file, run the switch statement using that.
         $extension = empty($file_path_info['extension']) ? NULL : strtolower($file_path_info['extension']);
         switch (true) {
             // Audio file
             case in_array($extension, wp_get_audio_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('audio')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $audio_settings = apply_filters('gravityview_audio_settings', array('src' => $file_path, 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the audio shortcode
                      * @link http://codex.wordpress.org/Audio_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
                      */
                     $content = wp_audio_shortcode($audio_settings);
                 }
                 break;
                 // Video file
             // Video file
             case in_array($extension, wp_get_video_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('video')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $video_settings = apply_filters('gravityview_video_settings', array('src' => $file_path, 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the video shortcode
                      * @link http://codex.wordpress.org/Video_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_video_shortcode/
                      */
                     $content = wp_video_shortcode($video_settings);
                 }
                 break;
                 // PDF
             // PDF
             case $extension === 'pdf':
                 // PDF needs to be displayed in an IFRAME
                 $link = add_query_arg(array('TB_iframe' => 'true'), $link);
                 break;
                 // if not image, do not set the lightbox (@since 1.5.3)
             // if not image, do not set the lightbox (@since 1.5.3)
             case !in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png')):
                 $disable_lightbox = true;
                 break;
         }
         // If using Link to File, override the content.
         // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
         if (!empty($field_settings['link_to_file'])) {
             // Force the content to be the file name
             $content = $file_path_info["basename"];
             // Restore the wrapped link
             $disable_wrapped_link = false;
         }
         // Whether to use lightbox or not
         if ($disable_lightbox || empty($gravityview_view->atts['lightbox']) || !empty($field_settings['show_as_link'])) {
             $link_atts = empty($field_settings['show_as_link']) ? "target='_blank'" : '';
             $link_atts = apply_filters('gravityview/fields/fileupload/link_atts', $link_atts, $gravityview_view->getCurrentField());
         } else {
             $link_atts = sprintf("rel='%s-{$entry['id']}' class='thickbox' target='_blank'", $gv_class);
         }
         /**
          * Filter to alter the default behaviour of wrapping images (or image names) with a link to the content object
          *
          * @since 1.5.1
          *
          * @param bool $disable_wrapped_link whether to wrap the content with a link to the content object.
          * @param array $gravityview_view->field_data
          *
          * @see GravityView_API:field_value() for info about $gravityview_view->field_data
          *
          */
         $disable_wrapped_link = apply_filters('gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField());
         // If the HTML output hasn't been overridden by the switch statement above, use the default format
         if (!empty($content) && empty($disable_wrapped_link)) {
             /**
              * Modify the link text (defaults to the file name)
              *
              * @since 1.7
              *
              * @param string $content The existing anchor content. Could be `<img>` tag, audio/video embed or the file name
              * @param array $field GravityView array of the current field being processed
              */
             $content = apply_filters('gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField());
             $content = '<a href="' . esc_url_raw($link) . '" ' . $link_atts . '>' . $content . '</a>';
         }
         $output_arr[] = array('file_path' => $file_path, 'content' => $content);
     }
     // End foreach loop
     /**
      * Modify the files array
      *
      * @since 1.7
      *
      * @param array $output_arr Associative array of files {
      *      @type string $file_path The path to the file as stored in Gravity Forms
      *      @type string $content The generated output for the file
      * }
      * @param array $field GravityView array of the current field being processed
      */
     $output_arr = apply_filters('gravityview/fields/fileupload/files_array', $output_arr, $gravityview_view->getCurrentField());
     return $output_arr;
 }
コード例 #7
0
ファイル: template-tags.php プロジェクト: TyRichards/paradox
 /**
  * Prints the WP Audio Shortcode to output the HTML for audio
  * @param  int $postid The post ID
  * @return string         The "hmtl" for printing audio elements
  */
 function base_print_audio_html($postid)
 {
     $output = '';
     $posttype = get_post_type($postid);
     $keys = array('post' => array('mp3' => '_zilla_audio_mp3', 'ogg' => '_zilla_audio_ogg'), 'portfolio' => array('mp3' => '_tzp_audio_file_mp3', 'ogg' => '_tzp_audio_file_ogg'));
     // Print an image if needed
     if ($posttype == 'portfolio') {
         $img = get_post_meta($postid, '_tzp_audio_poster_url', true);
         if ($img) {
             $output .= '<img src="' . esc_url_raw($img) . '" alt="' . esc_attr(get_the_title($postid)) . '" />';
         }
     } elseif (has_post_thumbnail($postid)) {
         $size = 'post-thumbnail';
         if (is_singular()) {
             $size = 'full';
         }
         $output .= get_the_post_thumbnail($postid, $size);
     }
     // Build the "shortcode"
     $mp3 = get_post_meta($postid, $keys[$posttype]['mp3'], true);
     $ogg = get_post_meta($postid, $keys[$posttype]['ogg'], true);
     $attr = array();
     if ($mp3) {
         $attr['mp3'] = $mp3;
     }
     if ($ogg) {
         $attr['ogg'] = $ogg;
     }
     $output .= wp_audio_shortcode($attr);
     return $output;
 }
コード例 #8
0
function powerpressplayer_build_mediaelementaudio($media_url, $EpisodeData = array(), $embed = false)
{
    if (!function_exists('wp_audio_shortcode')) {
        // Return the HTML5 audio shortcode instead
        return powerpressplayer_build_html5audio($media_url, $EpisodeData, $embed);
    }
    $player_id = powerpressplayer_get_next_id();
    $autoplay = false;
    // Episode Settings
    if (!empty($EpisodeData['autoplay'])) {
        $autoplay = true;
    }
    $content = '';
    $content .= '<div class="powerpress_player" id="powerpress_player_' . $player_id . '">' . PHP_EOL;
    $attr = array('src' => $media_url, 'loop' => '', 'autoplay' => $autoplay ? 'on' : '', 'preload' => 'none');
    $content .= wp_audio_shortcode($attr);
    $content .= '</div>' . PHP_EOL;
    return $content;
}
コード例 #9
0
ファイル: entry.php プロジェクト: yemingyuen/mingsg
             break;
     }
 } elseif ('audio' == $media['type']) {
     switch ($media['audio_type']) {
         case 'embed':
             global $wp_embed;
             if (is_a($wp_embed, 'WP_Embed')) {
                 echo $wp_embed->autoembed($media['audio_embed']);
             } else {
                 echo $media['audio_embed'];
             }
             break;
         case 'hosted':
             // Check if the attachment is an audio
             if (0 === strpos(get_post_mime_type($media['audio_src']), 'audio/')) {
                 echo wp_audio_shortcode(array('src' => wp_get_attachment_url($media['audio_src'])));
             }
             break;
     }
 } else {
     $attachments = array();
     foreach ($media['images'] as $image) {
         if ($attachment = wp_get_attachment_image_src($image, 'full')) {
             $attachments[$image] = $attachment;
         }
     }
     switch ($media['type']) {
         case 'slider':
             echo '<div class="royalSlider rsHelium" data-rs-settings="' . esc_attr(helium_rs_settings($media)) . '">';
             foreach ($attachments as $id => $attachment) {
                 echo wp_get_attachment_image($id, 'full', false, array('class' => 'attachment-full rsImg', 'data-rsw' => $attachment[1], 'data-rsh' => $attachment[2]));
コード例 #10
0
        echo "<li><img src='{$item}' alt='' /></li>";
    }
    echo "</ul>";
} elseif ($format === "video" && (array_key_exists('oembed-url', $tpl_default_settings) || array_key_exists('self-hosted-url', $tpl_default_settings))) {
    echo "<div class='dt-video-wrap'>";
    if (array_key_exists("oembed-url", $tpl_default_settings)) {
        echo wp_oembed_get($tpl_default_settings['oembed-url']);
    } elseif (array_key_exists("self-hosted-url", $tpl_default_settings)) {
        echo wp_video_shortcode(array('src' => $post_meta['self-hosted-url']));
    }
    echo "</div>";
} elseif ($format === "audio" && (array_key_exists('oembed-url', $tpl_default_settings) || array_key_exists('self-hosted-url', $tpl_default_settings))) {
    if (array_key_exists("oembed-url", $tpl_default_settings)) {
        echo wp_oembed_get($tpl_default_settings['oembed-url']);
    } elseif (array_key_exists("self-hosted-url", $tpl_default_settings)) {
        echo wp_audio_shortcode(array('src' => $post_meta['self-hosted-url']));
    }
} elseif (!array_key_exists("disable-featured-image", $tpl_default_settings)) {
    ?>
                  	<a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    printf(esc_attr__('%s'), the_title_attribute('echo=0'));
    ?>
"><?php 
    if (has_post_thumbnail()) {
        the_post_thumbnail("full");
    } elseif ($pholder != "on") {
        ?>
                        	<img src="http://placehold.it/1170x822&text=Image" alt="<?php 
コード例 #11
0
 /**
  * Gets the correct HTML embeds/elements for a given media type.
  *
  * @param string $type One of 'video', 'audio', or 'image'
  * @param int $post_id The WP post ID of the attachment media.
  *
  * @return string
  */
 private static function getIncidentMediaHtml($type, $post_id)
 {
     $html = '';
     switch ($type) {
         case 'video':
             $html .= wp_video_shortcode(array('src' => wp_get_attachment_url($post_id)));
             break;
         case 'image':
             $html .= '<a href="' . wp_get_attachment_url($post_id) . '" target="_blank">';
             $html .= wp_get_attachment_image($post_id);
             $html .= '</a>';
             break;
         case 'audio':
         default:
             $html .= wp_audio_shortcode(array('src' => wp_get_attachment_url($post_id)));
             break;
     }
     return $html;
 }
コード例 #12
0
	<a href="<?php 
the_permalink();
?>
" title="<?php 
the_title_attribute();
?>
">
		<span class="fui-volume"></span> <?php 
the_title();
?>
	</a>
</h2>
<div class="col-sm-4 col-md-2 col-lg-4">
<?php 
$attr = array('src' => $post->guid, 'loop' => 'off', 'preload' => 'metadata');
echo wp_audio_shortcode($attr);
$post_ancestors = get_post_ancestors($post);
foreach ($post_ancestors as $post_ancestor) {
    $ancestor = get_post($post_ancestor);
    _e('From', 'citypress');
    ?>
: <a href="<?php 
    echo get_permalink($post_ancestor);
    ?>
" title="<?php 
    echo apply_filters('the_title_attribute', $ancestor->post_title);
    ?>
">
	<?php 
    echo apply_filters('the_title', $ancestor->post_title);
    ?>
コード例 #13
0
ファイル: audio.php プロジェクト: rodrigo-brito/odin
    the_post();
    $metadata = wp_get_attachment_metadata();
    ?>
				<article <?php 
    post_class();
    ?>
>
					<header class="entry-header">
						<h1 class="entry-title"><?php 
    the_title();
    ?>
</h1>
					</header><!-- .entry-header -->
					<div class="entry-content entry-attachment">
						<?php 
    echo wp_audio_shortcode(array('src' => wp_get_attachment_url()));
    ?>

						<p><strong><?php 
    _e('URL:', 'odin');
    ?>
</strong> <a href="<?php 
    echo esc_url(wp_get_attachment_url());
    ?>
" title="<?php 
    the_title_attribute();
    ?>
" rel="attachment"><span><?php 
    echo esc_attr(basename(wp_get_attachment_url()));
    ?>
</span></a></p>
コード例 #14
0
 /**
  * @ticket 35367
  */
 function test_wp_audio_shortcode_attributes()
 {
     $actual = wp_audio_shortcode(array('src' => 'https://example.com/foo.mp3'));
     $this->assertContains('src="https://example.com/foo.mp3', $actual);
     $this->assertNotContains('loop', $actual);
     $this->assertNotContains('autoplay', $actual);
     $this->assertContains('preload="none"', $actual);
     $this->assertContains('class="wp-audio-shortcode"', $actual);
     $this->assertContains('style="width: 100%;"', $actual);
     $actual = wp_audio_shortcode(array('src' => 'https://example.com/foo.mp3', 'loop' => true, 'autoplay' => true, 'preload' => true, 'class' => 'foobar', 'style' => 'padding:0;'));
     $this->assertContains('src="https://example.com/foo.mp3', $actual);
     $this->assertContains('loop="1"', $actual);
     $this->assertContains('autoplay="1"', $actual);
     $this->assertContains('preload="1"', $actual);
     $this->assertContains('class="foobar"', $actual);
     $this->assertContains('style="padding:0;"', $actual);
 }
コード例 #15
0
/**
 * Output an audio field as a video player.
 *
 * @uses wp_audio_shortcode()
 *
 * @since 2.5
 *
 * @param string|array   $url   Can be a URL of the source file, or a Pods audio field.
 * @param bool|array     $args  Optional. Additional arguments to pass to wp_audio_shortcode
 *
 * @return string
 */
function pods_audio($url, $args = false)
{
    if (is_array($url)) {
        if (!is_null(pods_v('ID', $url))) {
            $id = pods_v('ID', $url);
            $url = wp_get_attachment_url($id);
        } else {
            return;
        }
    }
    $audio_args = array('src' => $url);
    if (is_array($args)) {
        $audio_args = array_merge($audio_args, $args);
    }
    return wp_audio_shortcode($args);
}
コード例 #16
0
 /**
  * Load audio player for given file
  * @param  string $src Source of audio file
  * @return mixed       Audio player HTML on success, false on failure
  */
 public function audio_player($src = '')
 {
     if ($src) {
         return wp_audio_shortcode(array('src' => $src));
     }
     return false;
 }
コード例 #17
0
ファイル: featured-header.php プロジェクト: rmens/podcaster
    function pod_featured_multimedia($post_id)
    {
        global $post;
        $plugin_inuse = get_pod_plugin_active();
        $post_format = get_post_format($post_id);
        $pod_featured_excerpt = pod_theme_option('pod-frontpage-fetured-ex');
        $post_featured_media = '';
        if ($plugin_inuse == 'ssp') {
            $pod_fh_heading = pod_theme_option('pod-featured-heading');
            $id = get_the_ID();
            $file = get_post_meta($post_id, 'enclosure', true);
            $terms = wp_get_post_terms($post_id, 'series');
            foreach ($terms as $term) {
                $series_id = $term->term_id;
                $series = $term->name;
                break;
            }
            $post_featured_media .= '<span class="mini-title">' . $pod_fh_heading . '</span>';
            $post_featured_media .= pod_explicit_post($post->ID);
            $post_featured_media .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
            if ($file != '') {
                $post_featured_media .= '<div class="audio"><div class="audio_player">' . do_shortcode('[audio src="' . $file . '"][/audio]') . '</div><!--audio_player--></div><!-- .audio -->';
            } else {
                $post_featured_media .= '';
            }
            if ($pod_featured_excerpt == true) {
                $post_featured_media .= '<div class="featured-excerpt ' . $post_format . '">';
                $post_featured_media .= get_the_excerpt();
                $post_featured_media .= '<a href="' . get_permalink() . '" class="more-link">';
                $post_featured_media .= __(' Read More', 'thstlang');
                $post_featured_media .= '<span class="meta-nav"></span>
								</a>';
                $post_featured_media .= '</div>';
            }
        } elseif ($plugin_inuse == 'bpp') {
            $pod_fh_heading = pod_theme_option('pod-featured-heading');
            $pp_audio_str = get_post_meta($post_id, 'enclosure', true);
            $pp_audiourl = strtok($pp_audio_str, "\n");
            $post_featured_media .= '<span class="mini-title">' . $pod_fh_heading . '</span>';
            $post_featured_media .= pod_explicit_post($post->ID);
            $post_featured_media .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
            if ($pp_audiourl != '') {
                $post_featured_media .= get_the_powerpress_content();
            }
            if ($pod_featured_excerpt == true) {
                $post_featured_media .= '<div class="featured-excerpt ' . $post_format . '">';
                $post_featured_media .= get_the_excerpt();
                $post_featured_media .= '<a href="' . get_permalink() . '" class="more-link">';
                $post_featured_media .= __(' Read More', 'thstlang');
                $post_featured_media .= '<span class="meta-nav"></span>
								</a>';
                $post_featured_media .= '</div>';
            }
        } else {
            if ($post_format == 'audio') {
                $audiourl = get_post_meta($post_id, 'cmb_thst_audio_url', true);
                $audioembed = get_post_meta($post_id, 'cmb_thst_audio_embed', true);
                $audioembedcode = get_post_meta($post_id, 'cmb_thst_audio_embed_code', true);
                $audiocapt = get_post_meta($post_id, 'cmb_thst_audio_capt', true);
                $audioplists = get_post_meta($post_id, 'cmb_thst_audio_playlist', true);
                $au_uploadcode = wp_audio_shortcode($audiourl);
                $audioex = get_post_meta($post_id, 'cmb_thst_audio_explicit', true);
                $options = get_option('podcaster-theme');
                $pod_fh_heading = isset($options['pod-featured-heading']) ? $options['pod-featured-heading'] : '';
                $excerpt_count = get_post_meta($post_id, 'cmb_thst_featured_post_excerpt_count', true);
                $has_excerpt = get_post_meta($post_id, 'cmb_thst_feature_post_excerpt', true);
                $post_object = get_post($post_id);
                $fheader_type = pod_theme_option('pod-featured-header-type');
                if ($fheader_type == 'static') {
                    $post_excerpt = get_the_excerpt();
                } else {
                    if ($has_excerpt == 'on') {
                        if ($post_object->post_excerpt) {
                            $post_excerpt = $post_object->post_excerpt;
                        } elseif (isset($excerpt_count)) {
                            $post_excerpt = pod_flexible_excerpt($post_id, $excerpt_count);
                        } else {
                            $post_excerpt = '';
                        }
                    } else {
                        $post_excerpt = '';
                    }
                }
                if ($audioembed != '') {
                    $file_parts = pathinfo($audioembed);
                    if (array_key_exists("extension", $file_parts)) {
                        $audioembed = '';
                        $au_embedcode = "<p>Please use a valid embed URL. Make sure it doesn't have a file extension, such as *.mp3.</p>";
                    } else {
                        $au_embedcode = wp_oembed_get($audioembed);
                    }
                    $post_featured_media .= '<div class="row">' . pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="audio_player au_oembed">' . $au_embedcode . '</div><!--audio_player-->') . '</div>';
                } elseif ($audiourl != '') {
                    $post_featured_media .= '<span class="mini-title">' . $pod_fh_heading . '</span>';
                    $post_featured_media .= pod_explicit_post($post->ID);
                    $post_featured_media .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
                    $post_featured_media .= '<div class="audio_player">' . do_shortcode('[audio src="' . $audiourl . '"][/audio]') . '</div><!--audio_player-->';
                    if ($pod_featured_excerpt == true) {
                        $post_featured_media .= '<div class="featured-excerpt ' . $post_format . '">';
                        $post_featured_media .= get_the_excerpt();
                        $post_featured_media .= '<a href="' . get_permalink() . '" class="more-link">';
                        $post_featured_media .= __(' Read More', 'thstlang');
                        $post_featured_media .= '<span class="meta-nav"></span>
								</a>';
                        $post_featured_media .= '</div>';
                    }
                } elseif (is_array($audioplists)) {
                    $post_featured_media .= '<div class="row">' . pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', do_shortcode('[playlist type="audio" ids="' . implode(',', array_keys($audioplists)) . '"][/playlist]')) . '</div>';
                } elseif ($audioembedcode != '') {
                    $post_featured_media .= '<div class="row">' . pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="audio_player embed_code">' . $audioembedcode . '</div><!--audio_player-->') . '</div>';
                } else {
                    $post_featured_media .= '';
                }
            } elseif ($post_format == 'video') {
                $options = get_option('podcaster-theme');
                $pod_fh_heading = isset($options['pod-featured-heading']) ? $options['pod-featured-heading'] : '';
                $excerpt_count = get_post_meta($post_id, 'cmb_thst_featured_post_excerpt_count', true);
                $has_excerpt = get_post_meta($post_id, 'cmb_thst_feature_post_excerpt', true);
                $post_object = get_post($post_id);
                $fheader_type = pod_theme_option('pod-featured-header-type');
                if ($fheader_type == 'static') {
                    $post_excerpt = get_the_excerpt();
                } else {
                    if ($has_excerpt == 'on') {
                        if ($post_object->post_excerpt) {
                            $post_excerpt = $post_object->post_excerpt;
                        } elseif (isset($excerpt_count)) {
                            $post_excerpt = pod_flexible_excerpt($post_id, $excerpt_count);
                        } else {
                            $post_excerpt = '';
                        }
                    } else {
                        $post_excerpt = '';
                    }
                }
                $videoembed = get_post_meta($post_id, 'cmb_thst_video_embed', true);
                $videoembedcode = get_post_meta($post_id, 'cmb_thst_video_embed_code', true);
                $videourl = get_post_meta($post_id, 'cmb_thst_video_url', true);
                $videocapt = get_post_meta($post_id, 'cmb_thst_video_capt', true);
                $videoplists = get_post_meta($post_id, 'cmb_thst_video_playlist', true);
                $videothumb = get_post_meta($post_id, 'cmb_thst_video_thumb', true);
                $videoex = get_post_meta($post_id, 'cmb_thst_video_explicit', true);
                $post_featured_media .= '<div class="row">';
                if ($videoembed != '') {
                    $post_featured_media .= pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="video_player">' . wp_oembed_get($videoembed) . '</div>');
                } elseif ($videourl != '') {
                    $post_featured_media .= pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="video_player"> ' . do_shortcode('[video poster="' . $videothumb . '" src="' . $videourl . '"][/video]') . '</div>');
                } elseif (is_array($videoplists)) {
                    $post_featured_media .= pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="video_player">' . do_shortcode('[playlist type="video" ids="' . implode(',', array_keys($videoplists)) . '"][/playlist]') . '</div>');
                } elseif ($videoembedcode != '') {
                    $post_featured_media .= pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="video_player">' . $videoembedcode . '</div>');
                } else {
                    $post_featured_media .= '';
                }
                $post_featured_media .= '</div>';
            }
        }
        return $post_featured_media;
    }
コード例 #18
0
ファイル: ctc-support.php プロジェクト: serranoabq/cultiv8
function cultiv8_the_sermon_details($post_id, $glyph = 'fa')
{
    $classes = array('container' => 'ctcex-sermon-container', 'media' => 'ctcex-sermon-media', 'details' => 'ctcex-sermon-details', 'date' => 'ctcex-sermon-date', 'speaker' => 'ctcex-sermon-speaker', 'series' => 'ctcex-sermon-series', 'topic' => 'ctcex-sermon-topic', 'audio-link' => 'ctcex-sermon-audio-link', 'audio' => 'ctcex-sermon-audio', 'video' => 'ctcex-sermon-video', 'img' => 'ctcex-sermon-img');
    $title = get_the_title($post_id);
    $data = cultiv8_get_sermon_data($post_id);
    // Sermon date
    $date_src = sprintf('<div class="%s"><b>%s:</b> %s</div>', $classes['date'], __('Date', 'ctcex'), get_the_date());
    // Get speaker
    $speaker_src = $data['speakers'] ? sprintf('<div class="%s"><b>%s:</b> %s</div>', $classes['speaker'], __('Speaker', 'ctcex'), $data['speakers']) : '';
    // Get series
    $series_src = $data['series'] ? sprintf('<div class="%s"><b>%s:</b> <a href="%s">%s</a></div>', $classes['series'], __('Series', 'ctcex'), $data['series_link'], $data['series']) : '';
    // Get topics
    // Topic name
    $topic_name = explode('/', cultiv8_get_option('ctc-sermon-topic', __('Topic', 'ctcex')));
    $topic_name = ucfirst(array_pop($topic_name));
    $topic_src = $data['topic'] ? sprintf('<div class="%s"><b>%s:</b> <a href="%s">%s</a></div>', $classes['topic'], $topic_name, $data['topic_link'], $data['topic']) : '';
    // Get audio link
    $audio_link_src = $data['audio'] ? sprintf('<div class="%s"><b>%s:</b> <a href="%s">%s</a></div>', $classes['audio-link'], __('Audio', 'ctcex'), $data['audio'], __('Download audio', 'ctcex')) : '';
    // Get audio display
    $audio_src = $data['audio'] ? sprintf('<div class="%s">%s</div>', $classes['audio'], wp_audio_shortcode(array('src' => $data['audio']))) : '';
    // Get video display
    $video_iframe_class = strripos($data['video'], 'iframe') ? 'iframe-container' : '';
    $video_src = $data['video'] ? sprintf('<div class="%s %s">%s</div>', $classes['video'], $video_iframe_class, $video_iframe_class ? $data['video'] : wp_video_shortcode(array('src' => $data['video']))) : '';
    // Use the image as a placeholder for the video
    $img_overlay_class = $data['video'] && $data['img'] ? 'ctcex-overlay' : '';
    $img_overlay_js = $img_overlay_class ? sprintf('<div class="ctcex-overlay">
			<i class="' . ($glyph === 'gi' ? 'genericon genericon-play' : 'fa fa-play') . '"></i>
		</div>
		<script>
			jQuery(document).ready( function($) {
				$( ".%s" ).css( "position", "relative" );
				$( ".ctcex-overlay" ).css( "cursor", "pointer" );
				var vid_src = \'%s\';
				vid_src = vid_src.replace( "autoPlay=false", "autoPlay=true" );
				$( ".ctcex-overlay" ).click( function(){
					$( this ).hide();
					$( ".ctcex-sermon-img" ).fadeOut( 200, function() {
						$( this ).replaceWith( vid_src );
						$( ".%s").addClass( "video_loaded" );
					});
				} );
			})
		</script>', $classes['media'], $video_src, $classes['media']) : '';
    // Get image
    $img_src = $data['img'] ? sprintf('%s<img class="%s" src="%s" alt="%s" width="960"/>', $img_overlay_js, $classes['img'], $data['img'], get_the_title()) : '';
    $video_src = $img_overlay_class ? $img_src : $video_src;
    $img_video_output = $video_src ? $video_src : $img_src . $audio_src;
    $names = cultiv8_get_option('ctc-sermons', __('sermons/sermon', 'cultiv8'));
    $plural_name = explode('/', strtolower($names));
    $single_name = array_pop($plural_name);
    // Prepare output
    $item_output = sprintf('<div class="%s">
			<div class="%s">%s</div>
			<div class="%s">
				%s
				%s
				%s
				%s
				%s
			</div>
		', $classes['container'], $classes['media'], $img_video_output, $classes['details'], $date_src, $speaker_src, $series_src, $topic_src, $audio_link_src);
    echo $item_output;
}
コード例 #19
0
 /**
  * Retrieve audio related to a post.
  *
  * @since 3.1.0
  * @uses $wp_embed
  * @todo Consider using get_enclosed(), too?
  * @todo Add support for the Crowd Favorite dealio.
  *
  * @param  int|WP_Post Optional. Post ID or object. Defaults to the current post in the loop.
  * @return string      HTML <audio> tag or empty string.
  */
 public function get_audio($post = 0)
 {
     global $wp_embed;
     $return_false_on_fail = $wp_embed->return_false_on_fail;
     $wp_embed->return_false_on_fail = true;
     $html = '';
     $post = get_post($post);
     // Extract an [audio] shortcode from the post content.
     if (has_shortcode($post->post_content, 'audio')) {
         if (preg_match_all('/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER)) {
             foreach ($matches as $shortcode) {
                 if ('audio' === $shortcode[2]) {
                     $html = do_shortcode($shortcode);
                     break;
                 }
             }
         }
     }
     // Check for autoembeds (links on their own lines) in the post content.
     if (empty($html) && preg_match_all('|^\\s*(https?://[^\\s"]+)\\s*$|im', $post->post_content, $matches)) {
         foreach ($matches[1] as $url) {
             $result = $wp_embed->shortcode(array(), $url);
             if (0 === strpos($result, '[audio')) {
                 $html = do_shortcode($result);
                 break;
             }
         }
     }
     // Check for audio attachments.
     if (empty($html)) {
         $attachments = get_posts(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'posts_per_page' => 1, 'fields' => 'ids', 'orderby' => 'menu_order', 'order' => 'asc'));
         if (!empty($attachments)) {
             $src = wp_get_attachment_url($attachments[0]);
             $html = wp_audio_shortcode(array('src' => $src));
         }
     }
     // Extract <audio> tags from the post content.
     if (empty($html)) {
         $embedded = get_media_embedded_in_content($post->post_content, array('audio'));
         $html = empty($embedded[0]) ? '' : $embedded[0];
     }
     // Reset the WP_Embed::return_false_on_fail setting.
     $wp_embed->return_false_on_fail = $return_false_on_fail;
     return apply_filters($this->theme->prefix . '_post_audio', $html, $post);
 }
            /* ]]> */
        </script>
        <script src="<?php 
echo amt_embed_make_https(amt_embed_get_includes_url('js/mediaelement/mediaelement-and-player.min.js'));
?>
"></script>
        <script src="<?php 
echo amt_embed_make_https(amt_embed_get_includes_url('js/mediaelement/wp-mediaelement.js'));
?>
"></script>

        <link rel="stylesheet" href="<?php 
echo amt_embed_make_https(amt_embed_get_includes_url('js/mediaelement/mediaelementplayer.min.css'));
?>
" />
        <link rel="stylesheet" href="<?php 
echo amt_embed_make_https(amt_embed_get_includes_url('js/mediaelement/wp-mediaelement.css'));
?>
" />

    </head>
    <body marginwidth="0" marginheight="0">

        <?php 
$attrs = array('src' => amt_embed_make_https(amt_embed_get_stream_url(amt_embed_get_id())), 'loop' => '', 'autoplay' => '', 'preload' => 'none');
echo do_shortcode(wp_audio_shortcode($attrs));
?>

    </body>
</html>
コード例 #21
0
    if ($mimetype) {
        $mimetype_array = explode('/', $mimetype);
        if (isset($mimetype_array[0]) && $mimetype_array[0]) {
            $question_media_type = $mimetype_array[0];
            $question_media_url = wp_get_attachment_url($question_media);
            $attachment = get_post($question_media);
            $question_media_title = $attachment->post_title;
            $question_media_description = $attachment->post_content;
            switch ($question_media_type) {
                case 'image':
                    $image_size = apply_filters('sensei_question_image_size', 'medium', $question_id);
                    $attachment_src = wp_get_attachment_image_src($question_media, $image_size);
                    $question_media_link = '<a class="' . esc_attr($question_media_type) . '" title="' . esc_attr($question_media_title) . '" href="' . esc_url($question_media_url) . '" target="_blank"><img src="' . $attachment_src[0] . '" width="' . $attachment_src[1] . '" height="' . $attachment_src[2] . '" /></a>';
                    break;
                case 'audio':
                    $question_media_link = wp_audio_shortcode(array('src' => $question_media_url));
                    break;
                case 'video':
                    $question_media_link = wp_video_shortcode(array('src' => $question_media_url));
                    break;
                default:
                    $question_media_filename = basename($question_media_url);
                    $question_media_link = '<a class="' . esc_attr($question_media_type) . '" title="' . esc_attr($question_media_title) . '" href="' . esc_url($question_media_url) . '" target="_blank">' . $question_media_filename . '</a>';
                    break;
            }
        }
    }
}
// Merge right and wrong answers and randomize
array_push($question_wrong_answers, $question_right_answer);
shuffle($question_wrong_answers);
コード例 #22
0
 function dt_sc_post($attrs, $content = null)
 {
     extract(shortcode_atts(array('id' => '1', 'read_more_text' => __('Read More', 'dt_themes'), 'excerpt_length' => 10, 'columns' => 1), $attrs));
     $p = get_post($id, 'ARRAY_A');
     $link = get_permalink($id);
     $format = get_post_format($id);
     $title = $p['post_title'];
     $author_id = $p['post_author'];
     $class = get_post_class("blog-entry no-border", $id);
     $class = implode(" ", $class);
     $tags = "";
     $terms = wp_get_post_tags($id);
     $post_meta = is_array(get_post_meta($id, '_dt_post_settings', TRUE)) ? get_post_meta($id, '_dt_post_settings', TRUE) : array();
     if (!empty($terms)) {
         $tags .= '<p class="tags"><i class="fa fa-tags"> </i>';
         foreach ($terms as $term) {
             $tags .= '<a href="' . get_term_link($term->slug, 'post_tag') . '"> ' . $term->name . '</a>,';
         }
         $tags = substr($tags, 0, -1);
         $tags .= '</p> <span> | </span> ';
     }
     $thumbnail_sidebar = '';
     $tpl_default_settings = get_post_meta(get_the_ID(), '_tpl_default_settings', TRUE);
     $tpl_default_settings = is_array($tpl_default_settings) ? $tpl_default_settings : array();
     $page_layout = array_key_exists("layout", $tpl_default_settings) ? $tpl_default_settings['layout'] : "content-full-width";
     if ($page_layout == 'with-left-sidebar' || $page_layout == 'with-right-sidebar') {
         $thumbnail_sidebar = '-single-sidebar';
     } elseif ($page_layout == 'both-sidebar') {
         $thumbnail_sidebar = '-both-sidebar';
     }
     if ($columns == 2) {
         if ($thumbnail_sidebar == "-single-sidebar") {
             $post_thumbnail = 'blog-two-column';
         } else {
             $post_thumbnail = 'blogcourse-two-column';
         }
     } elseif ($columns == 3) {
         $post_thumbnail = 'blogcourse-three-column';
     } else {
         $post_thumbnail = 'blog-one-column';
     }
     $post_thumbnail = $post_thumbnail . $thumbnail_sidebar;
     $out = '<article class="' . esc_attr($class) . '">';
     $out .= '	<div class="blog-entry-inner">';
     $out .= '		<div class="entry-thumb">';
     if ($format === "image" || empty($format)) {
         $out .= '<a href="' . esc_url($link) . '">';
         if (has_post_thumbnail($id)) {
             $out .= get_the_post_thumbnail($id, $post_thumbnail);
         } else {
             $out .= '<img src="http://placehold.it/1170x822&text=Image" alt="' . $title . '" />';
         }
         $out .= "</a>";
     } elseif ($format === "gallery" && array_key_exists("items", $post_meta)) {
         $out .= "<ul class='entry-gallery-post-slider'>";
         foreach ($post_meta['items'] as $item) {
             $attachment_id = dt_get_attachment_id_from_url($item);
             $img_attributes = wp_get_attachment_image_src($attachment_id, $post_thumbnail);
             $out .= "<li><img src='" . $img_attributes[0] . "' width='" . $img_attributes[1] . "' height='" . $img_attributes[2] . "' /></li>";
         }
         $out .= "</ul>";
     } elseif ($format === "video" && (array_key_exists('oembed-url', $post_meta) || array_key_exists('self-hosted-url', $post_meta))) {
         if (array_key_exists('oembed-url', $post_meta)) {
             $out .= "<div class='dt-video-wrap'>" . wp_oembed_get($post_meta['oembed-url']) . '</div>';
         } elseif (array_key_exists('self-hosted-url', $post_meta)) {
             $out .= "<div class='dt-video-wrap'>" . wp_video_shortcode(array('src' => $post_meta['self-hosted-url'])) . '</div>';
         }
     } elseif ($format === "audio" && (array_key_exists('oembed-url', $post_meta) || array_key_exists('self-hosted-url', $post_meta))) {
         if (array_key_exists('oembed-url', $post_meta)) {
             $out .= wp_oembed_get($post_meta['oembed-url']);
         } elseif (array_key_exists('self-hosted-url', $post_meta)) {
             $out .= wp_audio_shortcode(array('src' => $post_meta['self-hosted-url']));
         }
     } else {
         $out .= '<a href="' . esc_url($link) . '">';
         if (has_post_thumbnail($id)) {
             $out .= get_the_post_thumbnail($id, $post_thumbnail);
         } else {
             $out .= '<img src="http://placehold.it/1170x822&text=Image" alt="' . $title . '" />';
         }
         $out .= "</a>";
     }
     $excerpt = explode(' ', do_shortcode($p['post_content']), $excerpt_length);
     $excerpt = array_filter($excerpt);
     if (!empty($excerpt)) {
         if (count($excerpt) >= $excerpt_length) {
             array_pop($excerpt);
             $excerpt = implode(" ", $excerpt) . '...';
         } else {
             $excerpt = implode(" ", $excerpt);
         }
         $excerpt = preg_replace('`\\[[^\\]]*\\]`', '', $excerpt);
         $out .= '<div class="entry-thumb-desc"><p>' . $excerpt . '</p></div>';
     }
     $out .= '		</div> <!-- .entry-thumb -->';
     $out .= '		<div class="entry-details">';
     if (is_sticky()) {
         $out .= '<div class="featured-post"> <span class="fa fa-trophy"> </span> <span class="text">' . __('Featured', 'dt_themes') . '</span></div>';
     }
     $out .= '			<div class="entry-meta">';
     $out .= '				<div class="date">';
     $out .= get_the_time('d M', $id);
     $out .= '				</div>';
     $out .= "\t\t\t\t<a href='{$link}' class='entry_format'></a>";
     $out .= '			</div>';
     $out .= "\t\t\t<div class='entry-title'><h4><a href='{$link}'>{$title}</a></h4></div>";
     $out .= '			<div class="entry-metadata">';
     $out .= "\t\t\t\t<p class='author'><i class='fa fa-user'> </i> <a href='" . get_author_posts_url($author_id) . "'>" . get_the_author_meta('display_name', $author_id) . "</a></p><span> | </span>";
     $out .= $tags;
     $commtext = "";
     if (wp_count_comments($id)->approved == 0) {
         $commtext = '0';
     } else {
         $commtext = wp_count_comments($id)->approved;
     }
     $out .= "\t\t\t\t<p class='comments'><a href='{$link}/#respond' class='comments'><span class='fa fa-comments'> </span> {$commtext}</a></p>";
     $out .= '			</div>';
     $out .= '		</div>';
     $out .= '	</div>';
     $out .= '</article>';
     return $out;
 }
コード例 #23
0
ファイル: inc.playback.php プロジェクト: Nguyenkain/strida.vn
     if ($playback == 'compact') {
         $audiocorrect = "style='display:block; margin-bottom:5px;'";
         $loopaudio = $loopaudio == 'true' ? 'true' : 'false';
         $mfile = implode('|', $mfiles);
         $playeratts = array('fileurl' => fileaway_utility::urlesc($mfile), 'class' => 'ssfa-player ' . $icocol, 'loops' => $loopaudio);
         $player = $playaway->player($playeratts);
     } else {
         $audiocorrect = "style='margin-right:10px;'";
         $playeratts = array();
         if ($loopaudio == 'true') {
             $playeratts['loop'] = 'true';
         }
         foreach ($mfiles as $e => $s) {
             $playeratts[$e] = fileaway_utility::urlesc($s);
         }
         $player = '<div class="ssfa-player-extended">' . wp_audio_shortcode($playeratts) . '</div>';
     }
 }
 $sourcefilepath = $chosenpath . $pbdir . $rawname;
 $sourcefileurl = $playback_url . $pbdir . $rawname;
 $players = null;
 $sourcecount = 1;
 foreach ($sources as $audioext) {
     if (is_file($sourcefilepath . '.' . $audioext)) {
         $dlcolor = !$color ? " ssfa-" . $randcolor[array_rand($randcolor)] : " ssfa-{$colors}";
         $players .= $redirect ? '<a class="ssfa-audio-download' . $dlcolor . '" ' . 'href="' . $this->op['redirect'] . '" target="_blank">' : ($encryption ? '<a class="ssfa-audio-download ' . $dlcolor . '" ' . 'href="' . $encrypt->url($sourcefilepath . '.' . $audioext) . '" data-stat="' . $statstatus . '">' : ($s2mem ? '<a class="ssfa-audio-download ' . $dlcolor . '" ' . 'href="' . $url . '/?s2member_file_download=' . $s2dir . fileaway_utility::urlesc($rawname) . '.' . $audioext . $s2skip . '" data-stat="' . $statstatus . '">' : '<a class="ssfa-audio-download ' . $dlcolor . '" ' . 'href="' . fileaway_utility::urlesc($sourcefileurl) . '.' . $audioext . '" download="' . $rawname . '.' . $audioext . '" data-stat="' . $statstatus . '">'));
         $players .= '<div class="ssfa-audio-download" style="margin-bottom:10px;">';
         $players .= '<span class="ssfa-fileaplay-in ssfa-audio-download"></span>';
         $players .= strtoupper($audioext);
         $players .= '</div>';
         $players .= '</a>';
コード例 #24
0
ファイル: media.php プロジェクト: HaraShun/WordPress
/**
 * Displays the image and editor in the post editor
 *
 * @since 3.5.0
 */
function edit_form_image_editor($post)
{
    $open = isset($_GET['image-editor']);
    if ($open) {
        require_once ABSPATH . 'wp-admin/includes/image-edit.php';
    }
    $thumb_url = false;
    if ($attachment_id = intval($post->ID)) {
        $thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 450), true);
    }
    $alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
    $att_url = wp_get_attachment_url($post->ID);
    ?>
	<div class="wp_attachment_holder">
	<?php 
    if (wp_attachment_is_image($post->ID)) {
        $image_edit_button = '';
        if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
            $nonce = wp_create_nonce("image_editor-{$post->ID}");
            $image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <span class='spinner'></span>";
        }
        ?>

		<div class="imgedit-response" id="imgedit-response-<?php 
        echo $attachment_id;
        ?>
"></div>

		<div<?php 
        if ($open) {
            echo ' style="display:none"';
        }
        ?>
 class="wp_attachment_image" id="media-head-<?php 
        echo $attachment_id;
        ?>
">
			<p id="thumbnail-head-<?php 
        echo $attachment_id;
        ?>
"><img class="thumbnail" src="<?php 
        echo set_url_scheme($thumb_url[0]);
        ?>
" style="max-width:100%" alt="" /></p>
			<p><?php 
        echo $image_edit_button;
        ?>
</p>
		</div>
		<div<?php 
        if (!$open) {
            echo ' style="display:none"';
        }
        ?>
 class="image-editor" id="image-editor-<?php 
        echo $attachment_id;
        ?>
">
			<?php 
        if ($open) {
            wp_image_editor($attachment_id);
        }
        ?>
		</div>
	<?php 
    } elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'audio/')) {
        wp_maybe_generate_attachment_metadata($post);
        echo wp_audio_shortcode(array('src' => $att_url));
    } elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'video/')) {
        wp_maybe_generate_attachment_metadata($post);
        $meta = wp_get_attachment_metadata($attachment_id);
        $w = !empty($meta['width']) ? min($meta['width'], 640) : 0;
        $h = !empty($meta['height']) ? $meta['height'] : 0;
        if ($h && $w < $meta['width']) {
            $h = round($meta['height'] * $w / $meta['width']);
        }
        $attr = array('src' => $att_url);
        if (!empty($w) && !empty($h)) {
            $attr['width'] = $w;
            $attr['height'] = $h;
        }
        $thumb_id = get_post_thumbnail_id($attachment_id);
        if (!empty($thumb_id)) {
            $attr['poster'] = wp_get_attachment_url($thumb_id);
        }
        echo wp_video_shortcode($attr);
    }
    ?>
	</div>
	<div class="wp_attachment_details edit-form-section">
		<p>
			<label for="attachment_caption"><strong><?php 
    _e('Caption');
    ?>
</strong></label><br />
			<textarea class="widefat" name="excerpt" id="attachment_caption"><?php 
    echo $post->post_excerpt;
    ?>
</textarea>
		</p>


	<?php 
    if ('image' === substr($post->post_mime_type, 0, 5)) {
        ?>
		<p>
			<label for="attachment_alt"><strong><?php 
        _e('Alternative Text');
        ?>
</strong></label><br />
			<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php 
        echo esc_attr($alt_text);
        ?>
" />
		</p>
	<?php 
    }
    ?>

	<?php 
    $quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
    $editor_args = array('textarea_name' => 'content', 'textarea_rows' => 5, 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings);
    ?>

	<label for="content"><strong><?php 
    _e('Description');
    ?>
</strong><?php 
    if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
        echo ': ' . __('Displayed on attachment pages.');
    }
    ?>
</label>
	<?php 
    wp_editor($post->post_content, 'attachment_content', $editor_args);
    ?>

	</div>
	<?php 
    $extras = get_compat_media_markup($post->ID);
    echo $extras['item'];
    echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
}
コード例 #25
0
 /**
  * Wrapper for wp_audio_shortcode
  *
  * @since  0.1.1
  *
  * @return mixed The audio player if successful.
  */
 public function get_audio_player()
 {
     // Lazy-load the media-getting
     if (empty($this->media)) {
         $this->init_media();
     }
     $audio = $this->media['audio'];
     if (!isset($audio['type'])) {
         return '';
     }
     $audio_url = '';
     if ('url' === $audio['type']) {
         $audio_url = $audio['value'];
     } elseif ('attachment_id' === $audio['type']) {
         $audio_url = $audio['attachment_url'];
     }
     if ($audio_player = wp_audio_shortcode(array('src' => $audio_url))) {
         $audio_player = '<div class="gc-audio-wrap">' . $audio_player . '</div><!-- .gc-audio-wrap -->';
     }
     return $audio_player;
 }
コード例 #26
0
ファイル: audio.php プロジェクト: markc/mediapress
<?php

/**
 * Single audio view
 */
$media = mpp_get_current_media();
if (!$media) {
    return '';
}
$args = array('src' => mpp_get_media_src(), 'loop' => false, 'autoplay' => false);
echo wp_audio_shortcode($args);
コード例 #27
0
function sc_embed_player_templater1_handler($atts)
{
    extract(shortcode_atts(array('fileurl' => '', 'autoplay' => '', 'volume' => '', 'class' => '', 'loops' => ''), $atts));
    if (empty($fileurl)) {
        return '<div style="color:red;font-weight:bold;">Compact Audio Player Error! You must enter the mp3 file URL via the "fileurl" parameter in this shortcode. Please check the documentation and correct the mistake.</div>';
    }
    if (empty($class)) {
        $class = "sc_fancy_player_container";
        //Set default container class
    }
    if (empty($autoplay)) {
        //Set autoplay value
        $autoplay = "";
    } else {
        $autoplay = "on";
    }
    if (empty($loops)) {
        //Set the loops value
        $loops = "";
    } else {
        $loops = "on";
    }
    $args = array('src' => $fileurl, 'loop' => $loops, 'autoplay' => $autoplay, 'preload' => 'none');
    $player_container = "";
    $player_container .= '<div class="' . $class . '">';
    $player_container .= wp_audio_shortcode($args);
    $player_container .= '</div>';
    return $player_container;
}
コード例 #28
0
ファイル: frontend.php プロジェクト: edent/mp3-jplayer
 function replaceAudioShortcode($attr, $content = '')
 {
     /*	WP 4.0 [audio] shortcode attributes:	
      *	---
      *     @type string $src      URL to the source of the audio file. Default empty.
      *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default empty.
      *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
      *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default empty.
      *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
      *     @type string $id       The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instances}'.
      *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
      */
     $ops = $this->theSettings;
     $passToWP = true;
     $url = '';
     $i = 0;
     $output = '';
     if (!empty($attr['src'])) {
         if ($ops['replace_WP_embedded'] === 'true') {
             $url = $attr['src'];
             $passToWP = false;
         }
     } else {
         if ($ops['replace_WP_audio'] === 'true') {
             if (!empty($attr['mp3'])) {
                 $url = $attr['mp3'];
                 $passToWP = false;
             } elseif (!empty($attr['mp4'])) {
                 $url = $attr['mp4'];
                 $passToWP = false;
             } elseif (!empty($attr['m4a'])) {
                 $url = $attr['m4a'];
                 $passToWP = false;
             } elseif (!empty($attr['ogg'])) {
                 $url = $attr['ogg'];
                 $passToWP = false;
             } elseif (!empty($attr['oga'])) {
                 $url = $attr['oga'];
                 $passToWP = false;
             } elseif (!empty($attr['wav'])) {
                 $url = $attr['wav'];
                 $passToWP = false;
             } elseif (!empty($attr['webm'])) {
                 $url = $attr['webm'];
                 $passToWP = false;
             } elseif (!empty($attr['track']) || !empty($attr['tracks'])) {
                 //support user added 'track' param
                 $url = !empty($attr['track']) ? $attr['track'] : $attr['tracks'];
                 $passToWP = false;
             } else {
                 //nothing specified - will fallback to attachments, then custom fields (it's ok to fallback to
                 //fields last as new users are unlikely to use them and old users may want the functionality).
             }
         }
         if ($url === '' && $ops['replace_WP_attached'] === 'true') {
             global $post;
             $attachments = $this->getPostAttachedAudio($post->ID);
             $images = '';
             $ids = '';
             if ($attachments !== false) {
                 $images = 'true';
                 foreach ($attachments as $a) {
                     $ids .= $a->ID . ',';
                     $i++;
                 }
             }
             $attr['ids'] = $ids;
             if (empty($attr['images']) || $attr['images'] !== 'false') {
                 $attr['images'] = $images;
             }
             $passToWP = false;
         }
     }
     if ($passToWP) {
         //bailout
         $output = $content;
         if (function_exists('wp_audio_shortcode')) {
             //let WP process it
             $output = wp_audio_shortcode($attr, $content);
         }
         return $output;
     }
     //alias the params
     $attr['track'] = $url;
     $attr['loop'] = empty($attr['loop']) ? 'n' : 'y';
     $attr['autoplay'] = empty($attr['autoplay']) ? 'n' : 'y';
     $attr['text'] = !empty($attr['title']) && empty($attr['text']) ? $attr['title'] : (empty($attr['text']) ? '' : $attr['text']);
     //popout link text
     //process it
     $ops = $this->theSettings;
     if ($i > 1) {
         $output = $ops['replacerShortcode_playlist'] === 'player' ? $this->primary_player($attr, $content) : $this->popout_link_player($attr, $content);
     } else {
         if ($ops['replacerShortcode_single'] === 'mp3j') {
             $output = $this->inline_play_graphic($attr, $content);
         } elseif ($ops['replacerShortcode_single'] === 'mp3t') {
             $output = $this->inline_play_handler($attr, $content);
         } elseif ($ops['replacerShortcode_single'] === 'popout') {
             $output = $this->popout_link_player($attr, $content);
         } else {
             $output = $this->primary_player($attr, $content);
         }
     }
     return $output;
 }
コード例 #29
0
/**
 * Wrap attachment in paragraph tag before content.
 *
 * @since 2.0.0
 *
 * @param string $content
 * @return string
 */
function prepend_attachment($content)
{
    $post = get_post();
    if (empty($post->post_type) || $post->post_type != 'attachment') {
        return $content;
    }
    if (wp_attachment_is('video', $post)) {
        $meta = wp_get_attachment_metadata(get_the_ID());
        $atts = array('src' => wp_get_attachment_url());
        if (!empty($meta['width']) && !empty($meta['height'])) {
            $atts['width'] = (int) $meta['width'];
            $atts['height'] = (int) $meta['height'];
        }
        if (has_post_thumbnail()) {
            $atts['poster'] = wp_get_attachment_url(get_post_thumbnail_id());
        }
        $p = wp_video_shortcode($atts);
    } elseif (wp_attachment_is('audio', $post)) {
        $p = wp_audio_shortcode(array('src' => wp_get_attachment_url()));
    } else {
        $p = '<p class="attachment">';
        // show the medium sized image representation of the attachment if available, and link to the raw file
        $p .= wp_get_attachment_link(0, 'medium', false);
        $p .= '</p>';
    }
    /**
     * Filters the attachment markup to be prepended to the post content.
     *
     * @since 2.0.0
     *
     * @see prepend_attachment()
     *
     * @param string $p The attachment HTML output.
     */
    $p = apply_filters('prepend_attachment', $p);
    return "{$p}\n{$content}";
}
コード例 #30
0






                                                <!-- THIS IS THE OVERRIDE -->
                                                <?php 
                        //For the audio player
                        $audiourl = get_post_meta($post->ID, 'cmb_thst_audio_url', true);
                        $audioembed = get_post_meta($post->ID, 'cmb_thst_audio_embed', true);
                        $audioembedcode = get_post_meta($post->ID, 'cmb_thst_audio_embed_code', true);
                        $audiocapt = get_post_meta($post->ID, 'cmb_thst_audio_capt', true);
                        $audioplists = get_post_meta($post->ID, 'cmb_thst_audio_playlist', true);
                        $au_uploadcode = wp_audio_shortcode($audiourl);
                        $videoembed = get_post_meta($post->ID, 'cmb_thst_video_embed', true);
                        $videoembedcode = get_post_meta($post->ID, 'cmb_thst_video_embed_code', true);
                        $videourl = get_post_meta($post->ID, 'cmb_thst_video_url', true);
                        $videocapt = get_post_meta($post->ID, 'cmb_thst_video_capt', true);
                        $videoplists = get_post_meta($post->ID, 'cmb_thst_video_playlist', true);
                        $videothumb = get_post_meta($post->ID, 'cmb_thst_video_thumb', true);
                        $audioex = get_post_meta($post->ID, 'cmb_thst_audio_explicit', true);
                        $videoex = get_post_meta($post->ID, 'cmb_thst_video_explicit', true);
                        $post_format = get_post_format();
                        ?>
                                                <?php 
                        if ($audioex == 'on' || $videoex == 'on') {
                            ?>
                                                    <span class="mini-ex"><?php 
                            echo __('Explicit', 'thstlang');