PHP CodeStandard update

- all if/while/for/etc blocks have brackets on same line
- functions have brackets on new line
- no blocks without brackets
- all code starts on col 0 and there are no tab intends anymore

off: came case for classes and class methods
ignore: _ prefix functions (we can't change that anymore)
This commit is contained in:
2018-03-15 17:38:33 +09:00
parent 5226fbcfc3
commit 7d42256a30
42 changed files with 11623 additions and 12013 deletions

View File

@@ -6,50 +6,43 @@
* Some browser detection
*/
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var is_gecko = ((clientPC.indexOf('gecko') != -1) && (clientPC.indexOf('spoofer') == -1)
&& (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0') == -1));
var is_gecko = ((clientPC.indexOf('gecko') != -1) && (clientPC.indexOf('spoofer') == -1) &&
(clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0') == -1));
var is_safari = ((clientPC.indexOf('AppleWebKit') != -1) && (clientPC.indexOf('spoofer') == -1));
var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ));
if (clientPC.indexOf('opera') != -1)
{
if (clientPC.indexOf('opera') != -1) {
var is_opera = true;
var is_opera_preseven = (window.opera && !document.childNodes);
var is_opera_seven = (window.opera && document.childNodes);
}
function pop(theURL, winName, features)
{
function pop(theURL, winName, features) {
winName = window.open(theURL, winName, features);
winName.focus();
}
function emd_check_checkbox()
{
for (i = 0; i < document.manage_emails.length; i ++)
{
if (document.manage_emails.elements[i].checked == false && document.manage_emails.elements[i].type == 'checkbox')
{
function emd_check_checkbox() {
for (i = 0; i < document.manage_emails.length; i ++) {
if (document.manage_emails.elements[i].checked == false && document.manage_emails.elements[i].type == 'checkbox') {
document.manage_emails.elements[i].checked = true;
}
}
}
function expandTA(ta_id)
{
function expandTA(ta_id) {
var ta;
// if a string comes, its a get by id, else use it as an element pass on
if (!ta_id.length)
if (!ta_id.length) {
ta = ta_id;
else
} else {
ta = document.getElementById(ta_id);
}
var maxChars = ta.cols;
var theRows = ta.value.split("\n");
var numNewRows = 0;
for ( var i = 0; i < theRows.length; i++ )
{
if ((theRows[i].length+2) > maxChars)
{
for ( var i = 0; i < theRows.length; i++ ) {
if ((theRows[i].length+2) > maxChars) {
numNewRows += Math.ceil( (theRows[i].length+2) / maxChars ) ;
}
}
@@ -62,27 +55,27 @@ function expandTA(ta_id)
// DESC: shows or hides the menu
function ShowHideMenu(status, id)
{
if (status == 'show')
{
if (status == 'show') {
document.getElementById(id).style.visibility = 'visible';
if (document.getElementById('search_results').innerHTML)
if (document.getElementById('search_results').innerHTML) {
document.getElementById('search_results').style.visibility = 'visible';
}
else if (status == 'hide')
{
}
} else if (status == 'hide') {
document.getElementById(id).style.visibility = 'hidden';
if (document.getElementById('search_results').style.visibility == 'visible')
if (document.getElementById('search_results').style.visibility == 'visible') {
document.getElementById('search_results').style.visibility = 'hidden';
}
}
}
function ShowHideDiv(id)
{
element = document.getElementById(id);
if (element.className == 'visible' || !element.className)
if (element.className == 'visible' || !element.className) {
element.className = 'hidden';
else
} else {
element.className = 'visible';
}
// alert('E: ' + element.className + ' -- ' + element.style.visibility);
}
@@ -100,14 +93,16 @@ function mv(id, direction)
function le(id)
{
document.forms[form_name].action.value = 'load';
if (load_id)
if (load_id) {
document.forms[form_name].action_yes.value = confirm('Do you want to load this data?');
else
} else {
document.forms[form_name].action_yes.value = 'true';
}
document.forms[form_name].action_id.value = id;
document.forms[form_name].action_menu.value = id;
if (document.forms[form_name].action_yes.value == 'true')
if (document.forms[form_name].action_yes.value == 'true') {
document.forms[form_name].submit();
}
}
// METHOD: getWindowSize
@@ -119,7 +114,10 @@ function getWindowSize()
var width, height;
width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
height = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
return {width: width, height: height};
return {
width: width,
height: height
};
}
// METHOD: getScrollOffset
@@ -131,7 +129,10 @@ function getScrollOffset()
var left, top;
left = window.pageXOffset || (window.document.documentElement.scrollLeft || window.document.body.scrollLeft);
top = window.pageYOffset || (window.document.documentElement.scrollTop || window.document.body.scrollTop);
return {left: left, top: top};
return {
left: left,
top: top
};
}
// METHOD: setCenter
@@ -149,14 +150,12 @@ function setCenter(id, left, top)
// console.log('Id %s, type: %s, dimensions %s x %s, viewport %s x %s', id, $(id).getStyle('position'), dimensions.width, dimensions.height, viewport.width, viewport.height);
// console.log('Scrolloffset left: %s, top: %s', offset.left, offset.top);
// console.log('Left: %s, Top: %s (%s)', parseInt((viewport.width / 2) - (dimensions.width / 2) + offset.left), parseInt((viewport.height / 2) - (dimensions.height / 2) + offset.top), parseInt((viewport.height / 2) - (dimensions.height / 2)));
if (left)
{
if (left) {
$(id).setStyle ({
left: parseInt((viewport.width / 2) - (dimensions.width / 2) + offset.left) + 'px'
});
}
if (top)
{
if (top) {
// if we have fixed, we do not add the offset, else it moves out of the screen
var top_pos = type == 'fixed' ? parseInt((viewport.height / 2) - (dimensions.height / 2)) : parseInt((viewport.height / 2) - (dimensions.height / 2) + offset.top);
$(id).setStyle ({
@@ -178,15 +177,12 @@ function sh(id, showText, hideText)
// get status from element (hidden or visible)
divStatus = $(id).visible();
//console.log('Set flag %s for element %s', divStatus, id);
if (divStatus)
{
if (divStatus) {
// hide the element
Effect.BlindUp(id, {duration:0.3});
$(flag).value = 0;
$(btn).innerHTML = showText;
}
else if (!divStatus)
{
} else if (!divStatus) {
// show the element
Effect.BlindDown(id, {duration:0.3});
$(flag).value = 1;