]> git.mxchange.org Git - friendica.git/commitdiff
allow themes to change the size of embedded videos
authorZach Prezkuta <fermion@gmx.com>
Mon, 6 Aug 2012 15:59:57 +0000 (09:59 -0600)
committerZach Prezkuta <fermion@gmx.com>
Mon, 6 Aug 2012 15:59:57 +0000 (09:59 -0600)
boot.php
include/bbcode.php
include/oembed.php
view/theme/frost-mobile/profile_photo.tpl [new file with mode: 0644]
view/theme/frost-mobile/theme.php
view/theme/frost-mobile/wallwall_item.tpl

index 6a350c5f4dd3998cbd9267b48b7469bb1e233271..9702b71a832445459e075d1bb1508f3c4e5e9a1b 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -349,12 +349,22 @@ if(! class_exists('App')) {
                public  $plugins;
                public  $apps = array();
                public  $identities;
-               public  $sourcename = '';
        
                public $nav_sel;
 
                public $category;
 
+               // Allow themes to control internal parameters
+               // by changing App values in theme.php
+               //
+               // Possibly should make these part of the plugin
+               // system, but it seems like overkill to invoke
+               // all the plugin machinery just to change a couple
+               // of values
+               public  $sourcename = '';
+               public  $videowidth = 425;
+               public  $videoheight = 350;
+
                private $scheme;
                private $hostname;
                private $baseurl;
index d83cd35814a9f582c8b117d3b097f4026fe228d5..85c0059ccd7b8c815cbafdbc9f0de8fb48036b65 100644 (file)
@@ -325,7 +325,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
 
        // Try to Oembed
        if ($tryoembed) {
-               $Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="425" height="350"><a href="$1">$1</a></video>', $Text);
+               $Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text);
                $Text = preg_replace("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3))\[\/audio\]/ism", '<audio src="$1" controls="controls"><a href="$1">$1</a></audio>', $Text);
 
                $Text = preg_replace_callback("/\[video\](.*?)\[\/video\]/ism", 'tryoembed', $Text);
@@ -339,7 +339,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
 
 
        if ($tryoembed)
-               $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<iframe src="$1" width="425" height="350"><a href="$1">$1</a></iframe>', $Text);
+               $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<iframe src="$1" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></iframe>', $Text);
        else
                $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<a href="$1">$1</a>', $Text);
 
@@ -355,7 +355,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
        $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text);
 
        if ($tryoembed)
-               $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="425" height="350" src="http://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
+               $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
        else
                $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "http://www.youtube.com/watch?v=$1", $Text);
 
@@ -369,7 +369,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
        $Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
 
        if ($tryoembed)
-               $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="425" height="350" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
+               $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
        else
                $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", "http://vimeo.com/$1", $Text);
 
index a4452586eebb1cd79bd904fc81603ca8bab381a2..6fc4c5371709bcc96355a2c4e81f2e73ccf2d73d 100755 (executable)
@@ -12,7 +12,9 @@ function oembed_replacecb($matches){
 
 function oembed_fetch_url($embedurl){
 
-       $txt = Cache::get($embedurl);
+       $a = get_app();
+
+       $txt = Cache::get($a->videowidth . $embedurl);
 
        // These media files should now be caught in bbcode.php
        // left here as a fallback in case this is called from another source
@@ -38,7 +40,7 @@ function oembed_fetch_url($embedurl){
                                        $entries = $xpath->query("//link[@type='application/json+oembed']");
                                        foreach($entries as $e){
                                                $href = $e->getAttributeNode("href")->nodeValue;
-                                               $txt = fetch_url($href . '&maxwidth=425');
+                                               $txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
                                                break;
                                        }
                                }
@@ -47,7 +49,7 @@ function oembed_fetch_url($embedurl){
                
                if ($txt==false || $txt==""){
                        // try oohembed service
-                       $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=425';  
+                       $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth;  
                        $txt = fetch_url($ourl);
                }
                
@@ -55,7 +57,7 @@ function oembed_fetch_url($embedurl){
                if ($txt[0]!="{") $txt='{"type":"error"}';
        
                //save in cache
-               Cache::set($embedurl,$txt);
+               Cache::set($a->videowidth . $embedurl,$txt);
 
        }
        
diff --git a/view/theme/frost-mobile/profile_photo.tpl b/view/theme/frost-mobile/profile_photo.tpl
new file mode 100644 (file)
index 0000000..42fc139
--- /dev/null
@@ -0,0 +1,19 @@
+<h1>$title</h1>
+
+<form enctype="multipart/form-data" action="profile_photo" method="post">
+<input type='hidden' name='form_security_token' value='$form_security_token'>
+
+<div id="profile-photo-upload-wrapper">
+<label id="profile-photo-upload-label" for="profile-photo-upload">$lbl_upfile </label>
+<input name="userfile" type="file" id="profile-photo-upload" size="25" />
+</div>
+
+<div id="profile-photo-submit-wrapper">
+<input type="submit" name="submit" id="profile-photo-submit" value="$submit">
+</div>
+
+</form>
+
+<div id="profile-photo-link-select-wrapper">
+$select
+</div>
index 314361b9c9baec61e1557aac643629b64c10e41b..96d40958ef7029d60c9232995c1fe28199480bea 100644 (file)
@@ -4,7 +4,7 @@
  * Name: Frost--mobile version
  * Description: Like frosted glass
  * Credits: Navigation icons taken from http://iconza.com. Other icons taken from http://thenounproject.com, including: Like, Dislike, Black Lock, Unlock, Pencil, Tag, Camera, Paperclip (Marie Coons), Folder (Sergio Calcara), Chain-link (Andrew Fortnum), Speaker (Harold Kim), Quotes (Henry Ryder), Video Camera (Anas Ramadan), and Left Arrow, Right Arrow, and Delete X (all three P.J. Onori). All under Attribution (CC BY 3.0). Others from The Noun Project are public domain or No Rights Reserved (CC0).
- * Version: Version 0.2.3
+ * Version: Version 0.2.4
  * Author: Zach P <windforest@f.shmuz.in>
  * Maintainer: Zach P <windforest@f.shmuz.in>
  */
@@ -24,5 +24,7 @@ function frost_mobile_init(&$a) {
 
 
        $a->sourcename = 'Friendica mobile web';
+       $a->videowidth = 250;
+       $a->videoheight = 200;
 
 }
index 113987246c93bb47dd51c817a339fc38a5acb30e..e4d6b60bb4a8ed508efda481210b30ae089e76d4 100644 (file)
                     <ul class="wall-item-photo-menu" id="wall-item-photo-menu-$item.id">
                         $item.item_photo_menu
                     </ul>
-<!--                </div>-->
+                </div>-->
 
                        </div>
                        <!--<div class="wall-item-photo-end"></div>-->
                        <div class="wall-item-wrapper" id="wall-item-wrapper-$item.id" >
-                               {{ if $item.lock }}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="$item.lock" onclick="lockview(event,$item.id);" /></div>
+                               {{ if $item.lock }}<!--<div class="wall-item-lock">--><img src="images/lock_icon.gif" class="wall-item-lock lockview" alt="$item.lock" onclick="lockview(event,$item.id);" /><!--</div>-->
                                {{ else }}<div class="wall-item-lock"></div>{{ endif }} 
                                <div class="wall-item-location" id="wall-item-location-$item.id">$item.location</div>
                        </div>