--- a/brid-video-easy-publish/brid.php
+++ b/brid-video-easy-publish/brid.php
@@ -4,7 +4,7 @@
* Plugin Name: TargetVideo
* Plugin URI: https://target-video.com/
* Description: This plugin allows for the easy insertion of <a href="https://cms.target-video.com" target="_blank">TargetVideo</a> videos and playlists into your Wordpress site or blog. TargetVideo plugin seamlessly integrates with the Wordpress Media feature and provides an easy way to publish and monetize your video library.
- * Version: 3.8.8
+ * Version: 3.8.9
* Author: TargetVideo
* Settings: TargetVideo
* Author URI: https://target-video.com/
@@ -13,7 +13,7 @@
//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
//DO NOT CHANGE
-define('BRID_PLUGIN_VERSION', '3.8.8'); // Also change in upper comment
+define('BRID_PLUGIN_VERSION', '3.8.9'); // Also change in upper comment
define('DEFAULT_PLAYER_ID', '1');
define('DEFAULT_PARTNER_ID', '264');
define('BRID_PLUGIN_DIR', dirname(__FILE__));
--- a/brid-video-easy-publish/html/form/add_youtube.php
+++ b/brid-video-easy-publish/html/form/add_youtube.php
@@ -173,7 +173,7 @@
</div>
</div>
</td>
- <td class="videoTitleTable">
+ <td class="videoTitleTable" style="padding:0 10px;">
<div style="float:left;width:100%;">
<a href="{{providerUrl}}{{id}}" id="video-title-{{id}}" class="listTitleLink" title="View on {{service}}: {{title}}" target="_blank">{{title}}</a>
<div class="videoUploadedBy">
--- a/brid-video-easy-publish/html/form/post/add_youtube.php
+++ b/brid-video-easy-publish/html/form/post/add_youtube.php
@@ -165,7 +165,7 @@
<tbody>
<tr id="video-row-{{id}}" data-id="{{id}}" class="partnerTr" style="background-color:{{bgColor}}">
<td style="width:10px;"></td>
- <td class="imgTable">
+ <td class="imgTable" style="vertical-align:top;">
<div class="centerImg centerImgFix">
<div class="centerImgWrapper">
<a href="{{providerUrl}}{{id}}" title="View on {{service}}: {{title}}" target="_blank">
@@ -175,12 +175,13 @@
<div class="time" id="video-duration-{{id}}">{{duration}}</div>
</div>
</td>
- <td class="videoTitleTable">
+ <td class="videoTitleTable" style="padding:0 10px;">
<div style="float:left;width:100%;">
<a href="{{providerUrl}}{{id}}" id="video-title-{{id}}" class="listTitleLink" title="View on {{service}}: {{title}}" target="_blank">{{title}}</a>
<div class="videoUploadedBy">
<div class="siteVideosNum">
<?php _e('By'); ?>: {{author}}
+ <br>
<span style="color:#b5b5b5"><?php _e('Published'); ?>: {{published}}</span>
<br><br>
<span id="VideoStatusWrap" style="display:none">
@@ -319,6 +320,8 @@
}
}
+ jQuery("#VideoExternalUrl").val(responseData.url);
+
jQuery("td#td" + this.id + ' img').remove();
jQuery("td#td" + this.id).append('<div class="videoAdded">VIDEO ADDED!</div><div class="videoAdded2"><a href="#">EDIT IT HERE</a></div>');
--- a/brid-video-easy-publish/html/form/settings.php
+++ b/brid-video-easy-publish/html/form/settings.php
@@ -197,13 +197,10 @@
<small class="brid-notice"><?php _e('All your content on TargetVideo platform will be managed under this site/account'); ?>.<br /> <?php _e('To add more sites, please'); ?> <a href="https://cms.target-video.com/" target="_blank"><?php _e('login to TargetVideo'); ?></a>.</small>
</td>
</tr>
- <?php if ($wp_ver < 5) { ?>
- <tr>
- <td><?php _e('Replace default player with BridTv player'); ?></td>
- <td><?php BridForm::drawField('ovr_def', ['inputName' => 'brid_options[ovr_def]', 'type' => 'radio', 'label' => 'off']); ?></td>
- </tr>
- <?php } ?>
-
+ <tr>
+ <td><?php _e('Replace default player with TargetVideo player'); ?></td>
+ <td><?php BridForm::drawField('ovr_def', ['inputName' => 'brid_options[ovr_def]', 'type' => 'radio', 'label' => 'off']); ?></td>
+ </tr>
<tr>
<td><?php _e('Raw embed code'); ?></td>
<td><?php BridForm::drawField('raw_embed', ['inputName' => 'brid_options[raw_embed]', 'type' => 'radio', 'label' => 'off']); ?></td>
@@ -563,15 +560,27 @@
</small>
</td>
<td width="20%">
- <?php if ($v['Player']['id'] == $playerSelected) { ?>
-
- <a href="#" class="set-as-default-player default" data-model="player" data-id="<?php echo $v['Player']['id']; ?>">Default</a>
-
- <?php } else { ?>
-
- <a href="#" class="set-as-default-player" data-model="player" data-id="<?php echo $v['Player']['id']; ?>">Set as WP default</a>
-
- <?php } ?>
+ <?php if ($v['Player']['id'] == $playerSelected) : ?>
+ <a
+ href="#"
+ class="set-as-default-player default"
+ data-model="player"
+ data-id="<?php echo $v['Player']['id']; ?>"
+ data-width="<?php echo $v['Player']['width']; ?>"
+ data-height="<?php echo $v['Player']['height']; ?>">
+ Default
+ </a>
+ <?php else : ?>
+ <a
+ href="#"
+ class="set-as-default-player"
+ data-model="player"
+ data-id="<?php echo $v['Player']['id']; ?>"
+ data-width="<?php echo $v['Player']['width']; ?>"
+ data-height="<?php echo $v['Player']['height']; ?>">
+ <?php _e('Set as WP default'); ?>
+ </a>
+ <?php endif; ?>
</td>
</tr>
<?php } ?>
@@ -658,15 +667,27 @@
</small>
</td>
<td width="20%">
- <?php if ($v['Unit']['id'] == $unitSelected) { ?>
-
- <a class="set-as-default-unit default" data-model="unit" data-id="<?php echo $v['Unit']['id']; ?>"><?php _e('Default'); ?></a>
-
- <?php } else { ?>
-
- <a href="#" class="set-as-default-unit" data-model="unit" data-id="<?php echo $v['Unit']['id']; ?>"><?php _e('Set as WP default'); ?></a>
-
- <?php } ?>
+ <?php if ($v['Unit']['id'] == $unitSelected) : ?>
+ <a
+ href="#"
+ class="set-as-default-unit default"
+ data-model="unit"
+ data-id="<?php echo $v['Unit']['id']; ?>"
+ data-width="<?php echo $v['Unit']['width']; ?>"
+ data-height="<?php echo $v['Unit']['height']; ?>">
+ <?php _e('Default'); ?>
+ </a>
+ <?php else : ?>
+ <a
+ href="#"
+ class="set-as-default-unit"
+ data-model="unit"
+ data-id="<?php echo $v['Unit']['id']; ?>"
+ data-width="<?php echo $v['Unit']['width']; ?>"
+ data-height="<?php echo $v['Unit']['height']; ?>">
+ <?php _e('Set as WP default'); ?>
+ </a>
+ <?php endif; ?>
</td>
</tr>
<?php } ?>
@@ -1930,7 +1951,8 @@
e.preventDefault();
var type = _self.data('model');
var id = _self.data('id');
-
+ var width = _self.data('width');
+ var height = _self.data('height');
if (!_self.hasClass('default')) {
$Brid.Api.call({
@@ -1938,17 +1960,18 @@
data: {
action: "setBridProductDefault",
"id": id,
+ "width": width,
+ "height": height,
"type": type
},
//callback : { after : { name : "bridPlayerList"} }
callback: {
before: function() {
-
- jQuery('.set-as-default-' + type).removeClass('default');
+ // jQuery('.set-as-default-' + type).removeClass('default');
+ jQuery('.set-as-default-player, .set-as-default-unit').removeClass('default').text('Set as WP default');
jQuery('.set-as-default-' + type).text('Set as WP default');
_self.text('Default');
_self.addClass('default');
-
}
}
});
--- a/brid-video-easy-publish/html/library.php
+++ b/brid-video-easy-publish/html/library.php
@@ -5,7 +5,7 @@
//Playlist selected videos
var selectedVideos = new Array();
var playlistTitle = '';
- window.disable_shortcode = '<?php echo $disable_shortcode; ?>';
+ window.disable_shortcode = '<?php echo (int)$disable_shortcode; ?>';
window.CDN_Path = '<?php echo $CDN_Path; ?>';
</script>
<div class="supports-drag-drop" style="position: relative;">
--- a/brid-video-easy-publish/html/list/library/videos.php
+++ b/brid-video-easy-publish/html/list/library/videos.php
@@ -163,27 +163,28 @@
<?php
if (!empty($videosDataset['data'])) { ?>
- <table class="list-table">
- <?php
- $paginationOrder = '';
- $direction = '';
- $field = '';
- $pagination = $videosDataset['paging']['Video'];
+ <?php
+ $paginationOrder = '';
+ $direction = '';
+ $field = '';
+ $pagination = $videosDataset['paging']['Video'];
- if (isset($pagination['options']['order'])) {
- foreach ($pagination['options']['order'] as $k => $v) {
- $paginationOrder = 'sort:' . $k . '/direction:' . $v . '/';
- $direction = $v;
- $field = $k;
- }
+ if (isset($pagination['options']['order'])) {
+ foreach ($pagination['options']['order'] as $k => $v) {
+ $paginationOrder = 'sort:' . $k . '/direction:' . $v . '/';
+ $direction = $v;
+ $field = $k;
}
- $paginationFields = array(
- 'Title' => array('class' => 'tableTitle', 'field' => 'Video.name'),
- 'Published' => array('class' => 'tableCreated', 'field' => 'Video.publish'),
- 'Syndication' => array('class' => 'tableCreated', 'field' => false),
- );
+ }
+
+ $paginationFields = array(
+ 'Title' => array('class' => 'tableTitle', 'field' => 'Video.name'),
+ 'Published' => array('class' => 'tableCreated', 'field' => 'Video.publish'),
+ 'Syndication' => array('class' => 'tableCreated', 'field' => false),
+ );
+ ?>
- ?>
+ <table class="list-table">
<tbody>
<tr class="trFirst">
<th class="thName">
--- a/brid-video-easy-publish/html/list/playlist/playlistLibrary.php
+++ b/brid-video-easy-publish/html/list/playlist/playlistLibrary.php
@@ -68,7 +68,6 @@
var paginationOrder = '';
var saved = false;
- jQuery('#playlistSaveAdd').css('display', 'none');
jQuery('#playlistSaveAdd').addClass('disabled');
jQuery('#copy_shortcode').css('display', 'inline-block');
@@ -120,7 +119,6 @@
i.addClass('details selected');
- jQuery('#playlistSaveAdd').hide();
jQuery('#copy_shortcode').show();
var player_selected = $BridWordpressConfig.Player.id;
--- a/brid-video-easy-publish/html/playlist_library.php
+++ b/brid-video-easy-publish/html/playlist_library.php
@@ -39,7 +39,7 @@
<input type="text" id="brid_shortcode" style="width: 100px;height: 100px;display: none;" />
<div class="media-toolbar-primary">
<div class="mainWrapper" style='padding-top:0px;width:auto; position: absolute; right: 0px;top: 5px;width: 100%;text-align: right;'>
- <div class="bridButton" data-redirect="off" data-colorbox-close="0" id="copy_shortcode" data-method="onPlaylistUpdate" data-form-bind="0" data-form-req="0" style="position: absolute; right: 20px; top: 5px; display:none;">
+ <div class="bridButton" data-redirect="off" data-colorbox-close="0" id="copy_shortcode" data-method="onPlaylistUpdate" data-form-bind="0" data-form-req="0" style="position: absolute; right: 0; display:none;">
<div class="buttonLargeContent" id="videoSaveAddText"><?php _e('COPY SHORTCODE'); ?></div>
</div>
--- a/brid-video-easy-publish/lib/BridActions.php
+++ b/brid-video-easy-publish/lib/BridActions.php
@@ -150,19 +150,20 @@
*/
public static function setBridProductDefault()
{
-
if (!empty($_POST)) {
$type = isset($_POST['type']) ? sanitize_text_field($_POST['type']) : '';
-
if (in_array($type, ['player', 'unit'])) {
-
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
+ $width = isset($_POST['width']) ? intval($_POST['width']) : 16;
+ $height = isset($_POST['height']) ? intval($_POST['height']) : 9;
if ($id) {
-
BridOptions::updateOption($type, $id);
+ BridOptions::updateOption('width', $width);
+ BridOptions::updateOption('height', $height);
}
}
}
+
die("end");
}
@@ -448,7 +449,7 @@
$BridForm = new BridForm();
$disable_shortcode_selectbox = [
- "0" => "No",
+ "" => "No",
"1" => "Disable if SD is not encoded",
"2" => "Disable if ALL versions are not encoded",
];
--- a/brid-video-easy-publish/lib/BridApi.php
+++ b/brid-video-easy-publish/lib/BridApi.php
@@ -230,7 +230,7 @@
if (!empty($arguments['query'])) {
foreach ($arguments['query'] as $k => $queryPart) {
- $arguments['query'][$k] = str_replace(":", "=", $queryPart);
+ $arguments['query'][$k] = str_replace([":", "/"], ["=", "&"], $queryPart);
}
$queryStr = implode('&', $arguments['query']);
$url .= "?{$queryStr}";
--- a/brid-video-easy-publish/lib/BridHtml.php
+++ b/brid-video-easy-publish/lib/BridHtml.php
@@ -1307,7 +1307,18 @@
}
}
-
+// Debug
+function dump($data)
+{
+ print "<pre>";
+ print_r($data);
+ print "</pre>";
+}
+function dd($data)
+{
+ dump($data);
+ die;
+}
//Pre save filter to brid code
add_filter('content_save_pre', array('BridHtml', 'my_filter_brid_iframe_to_short'), 9, 1);
--- a/brid-video-easy-publish/lib/BridShortcode.php
+++ b/brid-video-easy-publish/lib/BridShortcode.php
@@ -201,7 +201,7 @@
$append = ',"placeholder":"true"';
if (isset($attrs['placeholder_img'])) {
- $append .= ',"placeholder_img":"' . $attrs['placeholder_img'] . '"';
+ $append .= ',"placeholder_img":"' . esc_html(sanitize_text_field(wp_unslash($attrs['placeholder_img']))) . '"';
}
if (isset($attrs['placeholder_type'])) {
$append .= ',"placeholder_type":"og_image"';
@@ -410,6 +410,9 @@
$embedCode .= '</iframe>';
}
+ // Add custom data to JSON: /wp-json/wp/v2/posts
+ self::restApiAddField($seoOptions);
+
return $embedCode;
}
@@ -465,6 +468,10 @@
$src = '';
$feat_image = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
+ $video_source = isset($atts["mp4"]) ? $atts["mp4"] : null;
+ if ($video_source == null) {
+ $video_source = isset($atts["src"]) ? $atts["src"] : "";
+ }
$postId = get_the_ID();
static $counter = 1;
@@ -474,7 +481,7 @@
$counter++;
//Front-end part
- $src .= "<!--WP embed code replace Video object - Brid Ver {BRID_PLUGIN_VERSION} --><script type='text/javascript' src='{CLOUDFRONT}player/build/brid.min.js'></script><div id='Brid_{$divId}' class='brid' style='width: {$size['width']}; height: {$size['height']};'></div><script type='text/javascript'> $bp('Brid_{$divId}', {"id":"{$playerId}", "stats":{"wps":1}, "video": {src: "{$atts['mp4']}", name: "{htmlspecialchars(get_the_title())}", image:"{$feat_image}"}, "width":"{$size['width']}", "height":"{$size['height']}"});</script>";
+ $src .= '<!--WP embed code replace Video object - Brid Ver.' . BRID_PLUGIN_VERSION . ' --><script type="text/javascript" src="' . CLOUDFRONT . 'player/build/brid.min.js"></script><div id="Brid_' . $divId . '" class="brid" style="width: ' . $size["width"] . '; height: ' . $size["height"] . ';"></div><script type="text/javascript"> $bp("Brid_' . $divId . '", {"id":"' . $playerId . '", "stats":{"wps":1}, "video": {"src": "' . esc_attr($video_source) . '", "name": "' . htmlspecialchars(get_the_title()) . '", "image":"' . $feat_image . '"}, "width":"' . $size["width"] . '", "height":"' . $size["height"] . '"});</script>';
return $src;
}
@@ -518,6 +525,24 @@
return array('width' => $width, 'height' => $height);
}
+
+ public static function restApiAddField($seoOptions)
+ {
+ $data = [];
+ foreach (['contenturl', 'thumbnailurl'] as $name) {
+ if (isset($seoOptions[$name])) {
+ $data[$name] = $seoOptions[$name];
+ }
+ }
+
+ register_rest_field('post', 'video_data', [
+ 'get_callback' => function ($post_arr) use ($data) {
+ return $data;
+ },
+ 'update_callback' => null,
+ 'schema' => null,
+ ]);
+ }
}
$overrideDefaultVideo = BridOptions::getOption('ovr_def', true);