Skip to content

Commit

Permalink
Release 2.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola Miljković committed Mar 5, 2018
2 parents 7dd4544 + 7c406a3 commit a3a792b
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 16 deletions.
29 changes: 29 additions & 0 deletions assets/css/sermon.css
Original file line number Diff line number Diff line change
Expand Up @@ -495,3 +495,32 @@ h3.wpfc_grid_title a {
.wpfc-sermon-single-topics {
margin-top: 24px;
}

/* Sermon Single - Audio */
.wpfc-sermon-single-audio {
display: flex;
justify-content: center;
}
.wpfc-sermon-single-audio-download {
display: flex;
align-items: center;
justify-content: center;
flex: none;
background: white;
padding: 0 1.25rem;
}
.wpfc-sermon-player {
vertical-align: middle;
}
.plyr {
flex: 1;
}
.plyr + .wpfc-sermon-single-audio-download {
border: 1px solid #dbe3e8;
}
.mejs-audio + .wpfc-sermon-single-audio-download {
background: #222;
}
.wpfc-sermon-player + .wpfc-sermon-single-audio-download {
display: none;
}
14 changes: 14 additions & 0 deletions assets/js/facebook-video.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* taken from https://developers.facebook.com/docs/plugins/embedded-video-player#wordpress */

window.fbAsyncInit = function() {
FB.init({
xfbml : true,
version : 'v2.5'
});
}; (function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
12 changes: 5 additions & 7 deletions includes/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,10 @@ public function displayImages( $atts = array() ) {
* @type string $atts ['size'] Image size. Possible options: sermon_small, sermon_medium, sermon_wide, thumbnail,
* medium, large, full, or any size added with add_image_size()
* @type bool $atts ['show_title'] false to hide the series title (true is the default)
* @type bool $atts ['show_desc'] false to hide the series description (true is the default)
* @type string $atts ['title_wrapper'] Possible options: p, h1, h2, h3, h4, h5, h6, div
* @type string $atts ['title_class'] CSS class for title
* @type string $atts ['service_type'] Service type ID/slug/name. Used to get latest series from that service type.
* @type bool $atts ['show_description'] true to show series description (false is the default)
* @type bool $atts ['show_description'] false to hide the series description (true is the default)
* @type string $atts ['wrapper_class'] CSS class for wrapper
*
* @return string
Expand All @@ -435,12 +434,11 @@ function displayLatestSeriesImage( $atts = array() ) {
$args = array(
'image_class' => 'latest-series-image',
'size' => 'large',
'show_title' => true,
'show_desc' => true,
'show_title' => 'yes',
'title_wrapper' => 'h3',
'title_class' => 'latest-series-title',
'service_type' => '',
'show_description' => false,
'show_description' => 'yes',
'wrapper_class' => 'latest-series',
);

Expand Down Expand Up @@ -487,11 +485,11 @@ function displayLatestSeriesImage( $atts = array() ) {
$image = wp_get_attachment_image( $series_image_id, $args['size'], false, array( 'class' => $image_class ) );

$title = $description = '';
if ( (bool) $args['show_title'] === true ) {
if ( $args['show_title'] === 'yes' ) {
$title = $latest_series->name;
$title = '<' . $args['title_wrapper'] . ' class="' . $title_class . '">' . $title . '</' . $args['title_wrapper'] . '>';
}
if ( (bool) $args['show_desc'] === true ) {
if ( $args['show_description'] === 'yes' ) {
$description = '<div class="latest-series-description">' . wpautop( $latest_series->description ) . '</div>';
}

Expand Down
4 changes: 2 additions & 2 deletions includes/sm-cmb-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ function wpfc_sermon_metaboxes() {
) );
$cmb2->add_field( array(
'name' => esc_html__( 'Video Embed Code', 'sermon-manager-for-wordpress' ),
'desc' => esc_html__( 'Paste your embed code for Vimeo, Youtube, or direct video file here', 'sermon-manager-for-wordpress' ),
'desc' => esc_html__( 'Paste your embed code for Vimeo, Youtube, Facebook, or direct video file here', 'sermon-manager-for-wordpress' ),
'id' => 'sermon_video',
'type' => 'textarea_code'
) );
$cmb2->add_field( apply_filters( 'sm_cmb2_field_sermon_video_link', array(
'name' => esc_html__( 'Video Link', 'sermon-manager-for-wordpress' ),
'desc' => esc_html__( 'Paste your link for Vimeo, Youtube, or direct video file here', 'sermon-manager-for-wordpress' ),
'desc' => esc_html__( 'Paste your link for Vimeo, Youtube, Facebook, or direct video file here', 'sermon-manager-for-wordpress' ),
'id' => 'sermon_video_link',
'type' => 'text_url'
) )
Expand Down
28 changes: 23 additions & 5 deletions includes/sm-template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ function wpfc_render_video( $url = '' ) {
return '';
}

if ( strpos( $url, 'facebook.' ) !== false ) {
wp_enqueue_script( 'wpfc-sm-fb-player' );

parse_str( parse_url( $url, PHP_URL_QUERY ), $query );

return '<div class="fb-video" data-href="' . $url . '" data-width="' . ( isset( $query['width'] ) ? ( is_numeric( $query['width'] ) ? $query['width'] : '600' ) : '600' ) . '" data-allowfullscreen="' . ( isset( $query['fullscreen'] ) ? ( $query['width'] === 'yes' ? 'true' : 'false' ) : 'true' ) . '"></div>';
}

$player = \SermonManager::getOption( 'player' ) ?: 'plyr';

if ( $player === 'wordpress' ) {
Expand Down Expand Up @@ -432,8 +440,14 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
<?php endif; ?>

<?php if ( get_wpfc_sermon_meta( 'sermon_audio' ) ) : ?>
<div class="wpfc-sermon-single-video wpfc-sermon-single-video-embed">
<div class="wpfc-sermon-single-audio">
<?php echo wpfc_render_audio( get_wpfc_sermon_meta( 'sermon_audio' ) ); ?>
<a class="wpfc-sermon-single-audio-download" href="<?php get_wpfc_sermon_meta('sermon_audio') ?>" download>
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"/>
</svg>
</a>
</div>
<?php endif; ?>
</div>
Expand Down Expand Up @@ -510,21 +524,25 @@ function wpfc_sermon_excerpt_v2( $return = false ) {
<div class="wpfc-sermon-meta-item wpfc-sermon-meta-date">
<?php sm_the_date() ?>
</div>
<div class="wpfc-sermon-description"><?php wpfc_sermon_description() ?></div>
<?php $sermon_description = get_post_meta($post->ID, 'sermon_description', true); ?>
<div class="wpfc-sermon-description"><?php echo wp_trim_words($sermon_description, 30); ?></div>
<div class="wpfc-sermon-footer">
<?php if ( has_term( '', 'wpfc_preacher', $post->ID ) ) : ?>
<div class="wpfc-sermon-meta-item wpfc-sermon-meta-preacher">
<?php the_terms( $post->ID, 'wpfc_preacher' ) ?>
<span class="wpfc-sermon-meta-prefix"><?php echo __( 'Preacher:', 'sermon-manager-for-wordpress' ) ?></span>
<span class="wpfc-sermon-meta-text"><?php the_terms( $post->ID, 'wpfc_preacher' ) ?></span>
</div>
<?php endif; ?>
<?php if ( get_post_meta( $post->ID, 'bible_passage', true ) ) : ?>
<div class="wpfc-sermon-meta-item wpfc-sermon-meta-passage">
<?php wpfc_sermon_meta( 'bible_passage' ) ?>
<span class="wpfc-sermon-meta-prefix"><?php echo __( 'Passage:', 'sermon-manager-for-wordpress' ) ?></span>
<span class="wpfc-sermon-meta-text"><?php wpfc_sermon_meta( 'bible_passage' ) ?></span>
</div>
<?php endif; ?>
<?php if ( has_term( '', 'wpfc_service_type', $post->ID ) ) : ?>
<div class="wpfc-sermon-meta-item wpfc-sermon-meta-service">
<?php the_terms( $post->ID, 'wpfc_service_type' ) ?>
<span class="wpfc-sermon-meta-prefix"><?php echo __( 'Service Type:', 'sermon-manager-for-wordpress' ) ?></span>
<span class="wpfc-sermon-meta-text"><?php the_terms( $post->ID, 'wpfc_service_type' ) ?></span>
</div>
<?php endif; ?>
</div>
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts
Requires at least: 4.5
Tested up to: 4.9.4
Requires PHP: 5.3
Stable tag: 2.12.0
Stable tag: 2.12.1
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -102,6 +102,12 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
2. Sermon Files

## Changelog ##
### 2.12.1 ###
* New: Add support for Facebook video links
* New: Sermon audio download button
* Fix: `latest_series` title and description parameter not working
* Fix: Sermons won't show long description on archive page

### 2.12.0 ###
* New: Add all new views, much more improved
* New: Add more options to sorting shortcode
Expand Down
4 changes: 3 additions & 1 deletion sermons.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Sermon Manager for WordPress
* Plugin URI: https://www.wpforchurch.com/products/sermon-manager-for-wordpress/
* Description: Add audio and video sermons, manage speakers, series, and more.
* Version: 2.12.0
* Version: 2.12.1
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down Expand Up @@ -540,6 +540,8 @@ public static function enqueue_scripts_styles() {
}
}

wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/js/facebook-video.js', array(), SM_VERSION );

switch ( \SermonManager::getOption( 'player' ) ) {
case 'mediaelement':
wp_enqueue_script( 'wp-mediaelement' );
Expand Down

0 comments on commit a3a792b

Please sign in to comment.