diff --git a/src/Item/Video/VideoItem.php b/src/Item/Video/VideoItem.php index 55bd9e3..7b03c17 100644 --- a/src/Item/Video/VideoItem.php +++ b/src/Item/Video/VideoItem.php @@ -106,16 +106,18 @@ protected function setTitle($title) */ protected function setContentLoc($loc) { - self::writeFullTag( - $loc, - 'content_loc', - true, - 'video:content_loc', - $this->validator, - 'validateContentLoc', - $this->exception, - 'Provided content URL is not a valid.' - ); + if ($loc) { + self::writeFullTag( + $loc, + 'content_loc', + true, + 'video:content_loc', + $this->validator, + 'validateContentLoc', + $this->exception, + 'Provided content URL is not a valid.' + ); + } return $this; } @@ -131,12 +133,14 @@ protected function setContentLoc($loc) */ protected function setPlayerLoc($loc, $playerEmbedded, $playerAutoPlay) { - self::$xml['player_loc'] = VideoItemPlayerTags::setPlayerLoc( - $this->validator, - $loc, - $playerEmbedded, - $playerAutoPlay - ); + if ($loc) { + self::$xml['player_loc'] = VideoItemPlayerTags::setPlayerLoc( + $this->validator, + $loc, + $playerEmbedded, + $playerAutoPlay + ); + } return $this; } diff --git a/src/Item/Video/VideoItemValidator.php b/src/Item/Video/VideoItemValidator.php index fbc2f1f..7498fed 100644 --- a/src/Item/Video/VideoItemValidator.php +++ b/src/Item/Video/VideoItemValidator.php @@ -65,11 +65,16 @@ public function validateThumbnailLoc($loc) /** * @param $title * - * @return bool + * @return string|false */ public function validateTitle($title) { - return self::validateString($title) && \strlen($title) < 97; + $length = \mb_strlen($title, 'UTF-8'); + if ($length > 0 && $length < 97) { + return self::validateString($title); + } + + return false; } /**