Понадобилось для замены артибутов картинок hspace,vspace на отступы css margin (атрибуты добавлял ckeditor, но это перекрывается стилями).
$(document).ready(function(){
$('img[hspace]').each(function(){
var pixels=parseInt($(this).attr('hspace'));
if(isNaN(pixels)||pixels<1){
pixels=0;
}else{
pixels=pixels/2;
}
$(this).css('marginLeft',pixels+'px')
.css('marginRight',pixels+'px')
.removeAttr('hspace');
});
$('img[vspace]').each(function(){
var pixels=parseInt($(this).attr('vspace'));
if (isNaN(pixels)||pixels<1) {
pixels=0;
}else{
pixels=pixels/2;
}
$(this).css('marginTop',pixels+'px')
.css('marginBottom',pixels+'px')
.removeAttr('vspace');
});
});
http://heathnewmedia.com/2012/04/01/hspace-vspace-jquery-fix-for-wordpress/
function number_format(number,decimals,dec_point,thousands_sep){
number=(number+'').replace(/[^0-9+\-Ee.]/g,'');
var n=!isFinite(+number)?0:+number,
prec=!isFinite(+decimals)?0:Math.abs(decimals),
sep=(typeof thousands_sep==='undefined')?',':thousands_sep,
dec=(typeof dec_point==='undefined')?'.':dec_point,
s='',
toFixedFix=function(n,prec){
var k=Math.pow(10,prec);
return ''+Math.round(n*k)/k;
};
s=(prec?toFixedFix(n,prec):''+Math.round(n)).split('.');
if(s[0].length>3){
s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep);
}
if((s[1]||'').length<prec){
s[1]=s[1]||'';
s[1]+=new Array(prec-s[1].length+1).join('0');
}
return s.join(dec);
}
Добавлено:
Еще варианты:
function number_format(str){
return str.replace(/(\s)+/g,'').replace(/(\d{1,3})(?=(?:\d{3})+$)/g,'$1 ');
}
function number_format(number,decimals,dec_point,thousands_sep){
var i,j,kw,kd,km;
if(isNaN(decimals=Math.abs(decimals))){
decimals=2;
}
if(dec_point==undefined){
dec_point=",";
}
if(thousands_sep==undefined){
thousands_sep=".";
}
i=parseInt(number=(+number||0).toFixed(decimals))+"";
if((j=i.length)>3){
j=j%3;
}else{
j=0;
}
km=(j?i.substr(0,j)+thousands_sep:"");
kw=i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+thousands_sep);
kd=(decimals?dec_point+Math.abs(number-i).toFixed(decimals).replace(/-/,0).slice(2):"");
return km+kw+kd;
}
Почти как первый (не проверен):
function number_format(number,decimals,dec_point,thousands_sep){
number=(number+'').replace(/[^0-9+\-Ee.]/g,'');
var n=!isFinite(+number)?0:+number,
prec=!isFinite(+decimals)?0:Math.abs(decimals),
sep=(typeof thousands_sep==='undefined')?',':thousands_sep,
dec=(typeof dec_point==='undefined')?'.':dec_point,
s='',
toFixedFix=function(n,prec){
var k=Math.pow(10,prec);
return ''+(Math.round(n*k)/k).toFixed(prec);
};
s=(prec?toFixedFix(n,prec):''+Math.round(n)).split('.');
if(s[0].length>3){
s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep);
}
if((s[1]||'').length<prec){
s[1]=s[1]||'';
s[1]+=new Array(prec-s[1].length+1).join('0');
}
return s.join(dec);
}
dism /online /Enable-Feature /FeatureName:TelnetClient
Действия при сворачивании и разворачивании блока..
function ToggleHSL() {
$('#hsl').slideToggle('normal',function(){
if ($(this).is(':hidden')) {
$('#top').css('margin-top','0px');
} else {
$('#top').css('margin-top','-216px');
}
return false;
});
}
http://www.sitepoint.com/forums/showthread.php?572201-jquery-finding-the-state-of-slideToggle
Содержание файла .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/media/
RewriteCond %{REQUEST_URI} !^/skin/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/var/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php [L]
В примере сбрасываем пароль для пользователя admin
на пароль password
:
UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';