Version Notes
Installation steps
Download this release
Release Info
| Developer | Niveus Solutions |
| Extension | Niveus_ProductVideo |
| Version | 1.3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.0 to 1.3.0
app/code/community/Niveus/ProductVideo/Block/Video.php
CHANGED
|
@@ -58,5 +58,58 @@ class Niveus_ProductVideo_Block_Video extends Mage_Catalog_Block_Product_View_Ab
|
|
| 58 |
->addFieldToFilter('product_id', $this->getProduct()->getId())
|
| 59 |
->addFieldToFilter('store_id', $storeId);
|
| 60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
}
|
| 58 |
->addFieldToFilter('product_id', $this->getProduct()->getId())
|
| 59 |
->addFieldToFilter('store_id', $storeId);
|
| 60 |
}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* This function checks the url is utube
|
| 65 |
+
* @param type $url
|
| 66 |
+
* @return type
|
| 67 |
+
*/
|
| 68 |
+
function is_youtube($url)
|
| 69 |
+
{
|
| 70 |
+
return (preg_match('/youtu\.be/i', $url) || preg_match('/youtube\.com\/watch/i', $url));
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* This function checks url has vimeo
|
| 75 |
+
* @param type $url
|
| 76 |
+
* @return type
|
| 77 |
+
*/
|
| 78 |
+
function is_vimeo($url)
|
| 79 |
+
{
|
| 80 |
+
return (preg_match('/vimeo\.com/i', $url));
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* This function get the youtube id.
|
| 85 |
+
* @param type $url
|
| 86 |
+
* @return string
|
| 87 |
+
*/
|
| 88 |
+
function youtube_video_id($url)
|
| 89 |
+
{
|
| 90 |
+
$pattern = '/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/';
|
| 91 |
+
preg_match($pattern, $url, $matches);
|
| 92 |
+
if (count($matches) && strlen($matches[7]) == 11)
|
| 93 |
+
{
|
| 94 |
+
return $matches[7];
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* This function get the vimeo id
|
| 100 |
+
* @param type $url
|
| 101 |
+
* @return string
|
| 102 |
+
*/
|
| 103 |
+
function vimeo_video_id($url)
|
| 104 |
+
{
|
| 105 |
+
$pattern = '/\/\/(www\.)?vimeo.com\/(\d+)($|\/)/';
|
| 106 |
+
preg_match($pattern, $url, $matches);
|
| 107 |
+
if (count($matches))
|
| 108 |
+
{
|
| 109 |
+
return $matches[2];
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
return '';
|
| 113 |
+
}
|
| 114 |
|
| 115 |
}
|
app/code/community/Niveus/ProductVideo/etc/config.xml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<Niveus_ProductVideo>
|
| 6 |
-
<version>1.
|
| 7 |
</Niveus_ProductVideo>
|
| 8 |
</modules>
|
| 9 |
|
| 3 |
<config>
|
| 4 |
<modules>
|
| 5 |
<Niveus_ProductVideo>
|
| 6 |
+
<version>1.3.0</version>
|
| 7 |
</Niveus_ProductVideo>
|
| 8 |
</modules>
|
| 9 |
|
app/design/frontend/default/default/template/niveusproductvideo/video.phtml
CHANGED
|
@@ -26,12 +26,17 @@
|
|
| 26 |
|
| 27 |
|
| 28 |
<?php foreach($_productVideos as $video) : ?>
|
| 29 |
-
<?php $
|
| 30 |
-
|
| 31 |
-
<?php if($
|
|
|
|
|
|
|
| 32 |
<?php echo "<iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/$video_code?rel=0\" frameborder=\"0\"></iframe>";?>
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
<?php endforeach; ?>
|
| 36 |
|
| 37 |
<?php endif;?>
|
| 26 |
|
| 27 |
|
| 28 |
<?php foreach($_productVideos as $video) : ?>
|
| 29 |
+
<?php $videourl = $this->getCode($video);?>
|
| 30 |
+
|
| 31 |
+
<?php if($this->is_youtube($videourl)):?>
|
| 32 |
+
<!-- video from youtube -->
|
| 33 |
+
<?php $video_code = $this->youtube_video_id($videourl);?>
|
| 34 |
<?php echo "<iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/$video_code?rel=0\" frameborder=\"0\"></iframe>";?>
|
| 35 |
+
<?php elseif($this->is_vimeo($videourl)):?>
|
| 36 |
+
<?php $video_code = $this->vimeo_video_id($videourl);?>
|
| 37 |
+
<?php echo "<iframe src=\"http://player.vimeo.com/video/$video_code?title=0&byline=0&portrait=0;loop=0\" width=\"560\" height=\"315\" frameborder=\"0\"></iframe>"; ?>
|
| 38 |
+
<?php endif; ?>
|
| 39 |
+
|
| 40 |
<?php endforeach; ?>
|
| 41 |
|
| 42 |
<?php endif;?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Niveus_ProductVideo</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>Niveus Youtube product Video extension</description>
|
| 11 |
<notes>Installation steps</notes>
|
| 12 |
<authors><author><name>Niveus Solutions</name><user>niveussolutions</user><email>support@niveussolutions.com</email></author></authors>
|
| 13 |
-
<date>2014-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Niveus"><dir name="ProductVideo"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Videos.php" hash="0e4ea8296cdf584cf9756cc086acec13"/><file name="Videos.php~" hash="c21edc574c4c186b23dbccc2d067b503"/></dir></dir></dir></dir></dir><dir name="Product"><dir name="View"><file name="Attribute.php~" hash="629d0759593202ee9d8886d863eff0c1"/><file name="List.php~" hash="9f52ae0257c000b26538daa0a6b5320c"/><file name="Media.php" hash="87141206ee837993560d66872c8f80b1"/><file name="Media.php~" hash="a512858484654f67e015b59def270d13"/></dir></dir><dir name="Rewrite"><file name="AdminhtmlCatalogProductEditTabs.php" hash="d4fcf87e7c895f792927b57dd9af9625"/><file name="AdminhtmlCatalogProductEditTabs.php~" hash="01e2d8cbbee88a7bbc68e5c05e933d54"/></dir><file name="Video.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Niveus_ProductVideo</name>
|
| 4 |
+
<version>1.3.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Niveus Youtube product Video extension</description>
|
| 11 |
<notes>Installation steps</notes>
|
| 12 |
<authors><author><name>Niveus Solutions</name><user>niveussolutions</user><email>support@niveussolutions.com</email></author></authors>
|
| 13 |
+
<date>2014-02-05</date>
|
| 14 |
+
<time>09:27:39</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Niveus"><dir name="ProductVideo"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Videos.php" hash="0e4ea8296cdf584cf9756cc086acec13"/><file name="Videos.php~" hash="c21edc574c4c186b23dbccc2d067b503"/></dir></dir></dir></dir></dir><dir name="Product"><dir name="View"><file name="Attribute.php~" hash="629d0759593202ee9d8886d863eff0c1"/><file name="List.php~" hash="9f52ae0257c000b26538daa0a6b5320c"/><file name="Media.php" hash="87141206ee837993560d66872c8f80b1"/><file name="Media.php~" hash="a512858484654f67e015b59def270d13"/></dir></dir><dir name="Rewrite"><file name="AdminhtmlCatalogProductEditTabs.php" hash="d4fcf87e7c895f792927b57dd9af9625"/><file name="AdminhtmlCatalogProductEditTabs.php~" hash="01e2d8cbbee88a7bbc68e5c05e933d54"/></dir><file name="Video.php" hash="7427647e5437bfc0bef5754c602c30f4"/><file name="Video.php~" hash="77668e1600fbb49e7884167842e1a6a3"/></dir><dir name="Helper"><file name="Data.php" hash="ab2f4060c3e9182f197f075b8e7faf50"/><file name="Data.php~" hash="ab2f4060c3e9182f197f075b8e7faf50"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Scrolling.php" hash="1d095e7d24d4e640fb3b11baa4027b77"/><file name="Scrolling.php~" hash="29faa4933274ad9848784b751730b7dc"/><file name="Titleposition.php" hash="af43b76604b69f24c58c4bf35bab40a3"/><file name="Titleposition.php~" hash="eca314ba351356270cd362da50f974f4"/><file name="Transition.php" hash="387dfb1df77743b982bb0cd8de7c85a1"/><file name="Transition.php~" hash="974787453cece93a0a85cf0fc3046c65"/></dir></dir><file name="Observer.php" hash="1965676480638ee512c57c03016af894"/><file name="Observer.php~" hash="1965676480638ee512c57c03016af894"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="0b890d0edf9f635c34d84e80410ab230"/><file name="Setup.php~" hash="392ab06b2156327c4a9e8a3d77160f4a"/></dir></dir><dir name="Videos"><file name="Collection.php" hash="1d5a542d7a919ddeccef1cf3c9607b2f"/><file name="Collection.php~" hash="701b62fdd06add657539e507a3212971"/></dir><file name="Videos.php" hash="4ac319ed11931591649f9ac4569d107b"/><file name="Videos.php~" hash="2d56dcba2e2548597e48bf1afbdb9a58"/></dir><file name="Videos.php" hash="d35074b3b0acd6426ec5df12cf63d077"/><file name="Videos.php~" hash="8bcb8be4da9a0a642722ac4a38ac6729"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VideosController.php" hash="7174a2ff3564f654110d94a16138bf5a"/><file name="VideosController.php~" hash="d5d5dff399e2a59559e8f635e58258a0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="a00ffae61be96cd04e435c830cf3fd4d"/><file name="config.xml" hash="919ec3640bb11b91c7871002a0c9a4b4"/><file name="system.xml" hash="b8f38b5efc46ec5a9e0ae6c7d02d6232"/></dir><dir name="sql"><dir name="niveus_productvideo_setup"><file name="mysql4-install-1.2.0.php" hash="4022ec194b52e4800bbe6061ecf8d61c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Niveus_ProductVideo.xml" hash="7d2fb29c666116bb33c0867e383e0788"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="niveusproductvideo.xml" hash="61f41423688de05affbfd3f0287d609d"/></dir><dir name="template"><dir name="niveusproductvideo"><dir name="tab"><file name="videos.phtml" hash="6d36682fbfe653e4aea4c657141ac18a"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="niveusproductvideo.xml" hash="de98ce985d056729d5f0f86e57809f7f"/></dir><dir name="template"><dir name="niveusproductvideo"><file name="video.phtml" hash="ce489ab1f2349470fe6d3b24f0d402ea"/></dir></dir></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
