allow themes to change the size of embedded videos
parent
f9f45fa957
commit
d8a13d6e8d
12
boot.php
12
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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in New Issue