Split feed links and fix parsing issue when no location set
This commit is contained in:
@@ -25,15 +25,29 @@ class SP_Meta_Box_Calendar_Feeds {
|
||||
$calendar_feeds = $feeds->calendar;
|
||||
?>
|
||||
<div>
|
||||
<?php foreach ( $calendar_feeds as $feed => $name ) { ?>
|
||||
<?php $link = str_replace( array( 'http:', 'https:' ), 'webcal:', add_query_arg( 'feed', 'sp-' . $feed, untrailingslashit( get_post_permalink( $post ) ) ) ); ?>
|
||||
<p>
|
||||
<strong><?php echo $name; ?></strong>
|
||||
<a class="sp-link" href="<?php echo $link; ?>" title="<?php _e( 'Link', 'sportspress' ); ?>"></a>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" value="<?php echo $link; ?>" readonly="readonly" class="code widefat">
|
||||
</p>
|
||||
<?php foreach ( $calendar_feeds as $slug => $formats ) { ?>
|
||||
<?php $link = add_query_arg( 'feed', 'sp-' . $slug, untrailingslashit( get_post_permalink( $post ) ) ); ?>
|
||||
<?php foreach ( $formats as $format ) { ?>
|
||||
<?php
|
||||
$protocol = sp_array_value( $format, 'protocol' );
|
||||
if ( $protocol ) {
|
||||
$feed = str_replace( array( 'http:', 'https:' ), 'webcal:', $link );
|
||||
} else {
|
||||
$feed = $link;
|
||||
}
|
||||
$prefix = sp_array_value( $format, 'prefix' );
|
||||
if ( $prefix ) {
|
||||
$feed = $prefix . urlencode( $feed );
|
||||
}
|
||||
?>
|
||||
<p>
|
||||
<strong><?php echo sp_array_value( $format, 'name' ); ?></strong>
|
||||
<a class="sp-link" href="<?php echo $feed; ?>" target="_blank" title="<?php _e( 'Link', 'sportspress' ); ?>"></a>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" value="<?php echo $feed; ?>" readonly="readonly" class="code widefat">
|
||||
</p>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user