1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-19 20:21:51 +02:00

Missing contentEditable script added. Removed unused zrssfeed script. Added default featurebox css for a fixed height. Experimental JS manager CDN check code added (but disabled for now)

This commit is contained in:
Cameron 2016-06-02 15:04:08 -07:00
parent 6c3638fc48
commit 0109e91271
6 changed files with 131 additions and 21 deletions

View File

@ -1252,8 +1252,10 @@ class e_file
*/
public function isValidURL($url)
{
ini_set('default_socket_timeout', 1);
$headers = get_headers($url);
// print_a($headers);
return (stripos($headers[0],"200 OK") || stripos($headers[0],"302")) ? true : false;
}

View File

@ -281,7 +281,7 @@ class e_jsmanager
//https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css
}
if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true') // Test with Local JS Framework files.
if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true' || !deftrue('e_CDN',true)) // Test with Local JS Framework files.
{
$this->_libraries['jquery'] = array(
"jquery/jquery.min.js"
@ -1285,8 +1285,12 @@ class e_jsmanager
if($label && E107_DEBUG_LEVEL > 0)
{
echo $external ? "<!-- [JSManager] ".$label." -->\n" : "/* [JSManager] ".$label." */\n\n";
e107::getDb()->db_Mark_Time("Load JS/CSS: ".$label);
}
$lmodified = 0;
foreach ($file_path_array as $path)
{
@ -1340,7 +1344,11 @@ class e_jsmanager
{
if($external !== 'css') $isExternal = true;
}
if('css' === $external)
{
@ -1358,7 +1366,11 @@ class e_jsmanager
}
$path = $tp->replaceConstants($path, 'abs').'?'.$this->getCacheId();
}
elseif($this->isValidUrl($path) === false)
{
continue;
}
echo $pre.'<link rel="stylesheet" media="'.$media.'" property="stylesheet" type="text/css" href="'.$path.'" />'.$post;
echo "\n";
@ -1388,14 +1400,16 @@ class e_jsmanager
// don't render non CDN libs as external script calls when script consolidation is enabled
if($mod === 'core' || $mod === 'plugin' || $mod === 'theme')
{
if(!e107::getPref('e_jslib_nocombine')) continue;
}
$path = $tp->replaceConstants($path, 'abs').'?'.$this->getCacheId();
}
if($isExternal === true && $this->isValidUrl($path) == false)
{
continue;
}
echo $pre.'<script type="text/javascript" src="'.$path.'"'.$inline.'></script>'.$post;
echo "\n";
@ -1416,11 +1430,33 @@ class e_jsmanager
}
return $lmodified;
}
/**
* Check CDN Url is valid.
* Experimental.
* @param $url
* @return resource
*/
private function isValidUrl($url)
{
return true;
/*
$connected = e107::getFile()->isValidURL($url);
if($connected == false)
{
// echo "<br />Skipping: ".$url ." : ".$port;
e107::getDebug()->log("Couldn't reach ".$url);
}
return $connected;
*/
}
/**

View File

@ -1,9 +1,9 @@
<?php
if (!defined('e107_INIT')){ exit; }
//XXX If you need 'camera' please include it in your theme file.
/*
if(USER_AREA)
{
e107::css('core','camera/css/camera.css','jquery');
}*/
?>
e107::css('featurebox', 'featurebox.css');
}

View File

@ -29,7 +29,7 @@ class featurebox_shortcodes// must match the plugin's folder name. ie. [PLUGIN_F
*/
function sc_featurebox($parm=null, $mod = '')
{
e107::css('featurebox', 'featurebox.css');
if($parm == null && $mod == '') // ie {FEATUREBOX}
{
$type = vartrue(e107::getPlugPref('featurebox','menu_category'),'bootstrap_carousel');

View File

@ -0,0 +1,80 @@
/*
* Content Editable Plugin for jQuery
* Version 1.0.0 (2013-02-15)
* Plugin website: http://labs.fellipesoares.com/plugins/contenteditable
* Author: Fellipe Soares Studio
* Author website: http://www.fellipesoares.com/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($,window,document){
var updateContent = function(element){
var c = $(element).html();
if(c == '' || c == '<br>' || c == ' ' || c == '</br>'){ c = ''; }
return c;
};
$.fn.contentEditable = function(options){
var defaults = {
'placeholder' : 'Insert content',
'newLineOnEnterKey' : false,
'onActivate' : false,
'onFocusIn' : false,
'onFocusOut' : false,
'onBlur' : false
};
var settings = $.extend( {}, defaults, options);
return this.each(function() {
$(this).attr("contenteditable","true");
this.content = $(this).html();
this.settings = settings;
if(this.content == ''){ $(this).html(settings.placeholder); }
$(this).on('activate',function(){
this.content = updateContent(this);
if(this.content == settings.placeholder){
$(this).empty();
var range, sel;
if ( (sel = document.selection) && document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(this);
range.select();
}
}
if($.isFunction(settings.onActivate)){ settings.onActivate(this); }
})
.focusin(function(e){
this.content = updateContent(this);
if(this.content == settings.placeholder){
$(this).empty();
var range = document.createRange();
range.selectNodeContents(this);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
if(settings.newLineOnEnterKey == false){
$(this).keypress(function(e){
var keycode = (e.keyCode ? e.keyCode : e.which);
if(keycode == '13') {
e.preventDefault();
$(this).focusout().blur();
}
});
}
if($.isFunction(settings.onFocusIn)){ settings.onFocusIn(this); }
})
.focusout(function(e){
this.content = updateContent(this);
$(this).unbind("keypress");
if(this.content == ''){ $(this).html(settings.placeholder); }
if($.isFunction(settings.onFocusOut)){ settings.onFocusOut(this); }
}).blur(function(e){
if($.isFunction(settings.onBlur)){ settings.onBlur(this); }
});
});
}
})(jQuery,window,document);

View File

@ -1,8 +0,0 @@
(function(l){l.fn.rssfeed=function(b,h,w){h=l.extend({limit:10,offset:1,header:!0,titletag:"h4",date:!0,dateformat:"datetime",content:!0,snippet:!0,media:!0,showerror:!0,errormsg:"",key:null,ssl:!1,linktarget:"_self",linkredirect:"",linkcontent:!1,sort:"",sortasc:!0,historical:!1},h);return this.each(function(z,q){var u=l(q),f="";h.ssl&&(f="s");u.hasClass("rssFeed")||u.addClass("rssFeed");if(null==b)return!1;0<h.offset&&(h.offset-=1);h.limit+=h.offset;f="http"+f+"://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+
encodeURIComponent(b);f+="&num="+h.limit;h.historical&&(f+="&scoring=h");null!=h.key&&(f+="&key="+h.key);l.getJSON(f+"&output=json_xml",function(b){if(200==b.responseStatus){var f=b.responseData,e=h;if(b=f.feed){var j=[],d=0,m="",v="odd";if(e.media){var n=f.xmlString;"Microsoft Internet Explorer"==navigator.appName?(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(n)):d=(new DOMParser).parseFromString(n,"text/xml");n=d.getElementsByTagName("item")}e.header&&(m+='<div class="rssHeader"><a href="'+
b.link+'" title="'+b.description+'">'+b.title+"</a></div>");m+='<div class="rssBody"><ul>';for(f=e.offset;f<b.entries.length;f++){d=f-e.offset;j[d]=[];var g=b.entries[f],a,c="",k=g.link;switch(e.sort){case "title":c=g.title;break;case "date":c=g.publishedDate}j[d].sort=c;if(g.publishedDate)switch(c=new Date(g.publishedDate),a=c.toLocaleDateString()+" "+c.toLocaleTimeString(),e.dateformat){case "datetime":break;case "date":a=c.toLocaleDateString();break;case "time":a=c.toLocaleTimeString();break;case "timeline":a=
new Date(c);a=Math.round(((new Date).getTime()-a.getTime())/1E3);60>a?a="< 1 min":(3600>a?(a=Math.round(a/60)-1,c="min"):86400>a?(a=Math.round(a/3600)-1,c="hour"):604800>a?(a=Math.round(a/86400)-1,c="day"):(a=Math.round(a/604800)-1,c="week"),1<a&&(c+="s"),a=a+" "+c);break;default:a=c,c=new Date(a),a=e.dateformat,a=a.replace("dd",p(c.getDate())),a=a.replace("MMMM",x(c.getMonth())),a=a.replace("MM",p(c.getMonth()+1)),a=a.replace("yyyy",c.getFullYear()),a=a.replace("hh",p(c.getHours())),a=a.replace("mm",
p(c.getMinutes())),a=a.replace("ss",p(c.getSeconds()))}e.linkredirect&&(k=encodeURIComponent(k));j[d].html="<"+e.titletag+'><a href="'+e.linkredirect+k+'" title="View this feed at '+b.title+'">'+g.title+"</a></"+e.titletag+">";e.date&&a&&(j[d].html+="<div>"+a+"</div>");e.content&&(g=e.snippet&&""!=g.contentSnippet?g.contentSnippet:g.content,e.linkcontent&&(g='<a href="'+e.linkredirect+k+'" title="View this feed at '+b.title+'">'+g+"</a>"),j[d].html+="<p>"+g+"</p>");if(e.media&&0<n.length&&(k=n[f].getElementsByTagName("enclosure"),
0<k.length)){j[d].html+='<div class="rssMedia"><div>Media files</div><ul>';for(g=0;g<k.length;g++){var r=k[g].getAttribute("url"),s=k[g].getAttribute("type"),t=k[g].getAttribute("length"),c=j[d],y=j[d].html,r='<li><a href="'+r+'" title="Download this media">'+r.split("/").pop()+"</a> ("+s+", ",s=Math.floor(Math.log(t)/Math.log(1024)),t=(t/Math.pow(1024,Math.floor(s))).toFixed(2)+" "+"bytes kb MB GB TB PB".split(" ")[s];c.html=y+(r+t+")</li>")}j[d].html+="</ul></div>"}}e.sort&&j.sort(function(a,c){if(e.sortasc)var b=
a.sort,d=c.sort;else b=c.sort,d=a.sort;if("date"==e.sort)return new Date(b)-new Date(d);b=b.toLowerCase();d=d.toLowerCase();return b<d?-1:b>d?1:0});l.each(j,function(a){m+='<li class="rssRow '+v+'">'+j[a].html+"</li>";v="odd"==v?"even":"odd"});m+="</ul></div>";l(q).html(m);l("a",q).attr("target",e.linktarget)}l.isFunction(w)&&w.call(this,u)}else h.showerror&&(d=""!=h.errormsg?h.errormsg:b.responseDetails),l(q).html('<div class="rssError"><p>'+d+"</p></div>")})})};var p=function(b){b+="";2>b.length&&
(b="0"+b);return b},x=function(b){return"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")[b]}})(jQuery);