Core libraries white space fixes

This commit is contained in:
2017-11-24 13:27:13 +09:00
parent 7a8fdcdf07
commit 967af4dc37
5 changed files with 69 additions and 69 deletions

View File

@@ -81,7 +81,7 @@
// set page name
$this->page_name = $this->get_page_name();
// set the action ids
foreach ($this->action_list as $_action)
{
@@ -102,7 +102,7 @@
$this->queue_key = join('', array_map(function () { $range = $GLOBALS['_KEY_RANGE']; return $range[rand(0, (count($range) - 1))]; }, range(1, 3)));
}
}
// deconstructor
public function __destruct()
{
@@ -110,7 +110,7 @@
}
// INTERNAL METHODS |===============================================>
// PUBLIC METHODS |=================================================>

View File

@@ -14,7 +14,7 @@
class ProgressBar
{
// private vars
public $code; // unique code
public $status = 'new'; // current status (new,show,hide)
public $step = 0; // current step
@@ -22,12 +22,12 @@ class ProgressBar
public $clear_buffer_size = 1; // we need to send this before the lfush to get browser output
public $clear_buffer_size_init = 1024*1024; // if I don't send that junk, it won't send anything
// public vars
public $min = 0; // minimal steps
public $max = 100; // maximal steps
public $left = 5; // bar position from left
public $top = 5; // bar position from top
public $width = 300; // bar width
@@ -38,9 +38,9 @@ class ProgressBar
public $bgr_color_master = '#ffffff'; // master div background color
public $border = 1; // bar border width
public $brd_color = '#000000'; // bar border color
public $direction = 'right'; // direction of motion (right,left,up,down)
public $frame = array('show' => false); // ProgressBar Frame
/* 'show' => false, # frame show (true/false)
'left' => 200, # frame position from left
@@ -51,7 +51,7 @@ class ProgressBar
'border' => 2, # frame border
'brd_color' => '#dfdfdf #404040 #404040 #dfdfdf' # frame border color
*/
public $label = array(); // ProgressBar Labels
/* 'name' => array( # label name
'type' => 'text', # label type (text,button,step,percent,crossbar)
@@ -68,7 +68,7 @@ class ProgressBar
'bgr_color' => '' # label background color
)
*/
// constructor
public function __construct($width = 0, $height = 0)
{
@@ -81,9 +81,9 @@ class ProgressBar
$this->_flushCache($this->clear_buffer_size_init);
$this->_flushCache($this->clear_buffer_size_init);
}
// private functions
private function _flushCache($clear_buffer_size = 0)
{
if (!$clear_buffer_size)
@@ -103,7 +103,7 @@ class ProgressBar
$percent = 100;
return $percent;
}
private function _calculatePosition($step)
{
switch ($this->direction)
@@ -125,7 +125,7 @@ class ProgressBar
$pixel = 0;
if ($step >= $this->max)
$pixel = $bar - ($this->pedding * 2);
switch ($this->direction)
{
case 'right':
@@ -155,7 +155,7 @@ class ProgressBar
}
return $position;
}
private function _setStep($step)
{
if ($step > $this->max)
@@ -164,7 +164,7 @@ class ProgressBar
$step = $this->min;
$this->step = $step;
}
// public functions
public function setFrame($width = 0, $height = 0)
{
@@ -178,13 +178,13 @@ class ProgressBar
'border' => 2,
'brd_color' => '#dfdfdf #404040 #404040 #dfdfdf'
);
if ($width > 0)
$this->frame['width'] = $width;
if ($height > 0)
$this->frame['height'] = $height;
}
public function addLabel($type, $name, $value = ' ')
{
switch($type)
@@ -280,14 +280,14 @@ class ProgressBar
break;
}
}
public function addButton($name, $value, $action, $target = 'self')
{
$this->addLabel('button', $name, $value);
$this->label[$name]['action'] = $action;
$this->label[$name]['target'] = $target;
}
public function setLabelPosition($name, $left, $top, $width, $height, $align='')
{
// print "SET POSITION[$name]: $left<br>";
@@ -301,7 +301,7 @@ class ProgressBar
if ($align != '')
$this->label[$name]['align'] = $align;
}
}
// init
if ($this->status != 'new')
{
@@ -316,7 +316,7 @@ class ProgressBar
$this->_flushCache();
}
}
public function setLabelColor($name, $color)
{
$this->label[$name]['color'] = $color;
@@ -326,7 +326,7 @@ class ProgressBar
$this->_flushCache();
}
}
public function setLabelBackground($name, $color)
{
$this->label[$name]['bgr_color'] = $color;
@@ -336,7 +336,7 @@ class ProgressBar
$this->_flushCache();
}
}
public function setLabelFont($name, $size, $family = '', $weight = '')
{
// just in case if it is too small
@@ -355,7 +355,7 @@ class ProgressBar
$this->label[$name]['font-family'] = $family;
if ($weight != '')
$this->label[$name]['font-weight'] = $weight;
if ($this->status != 'new')
{
$output = '<script type="text/JavaScript">';
@@ -367,7 +367,7 @@ class ProgressBar
$this->_flushCache();
}
}
public function setLabelValue($name, $value)
{
$this->label[$name]['value'] = $value;
@@ -378,7 +378,7 @@ class ProgressBar
$this->_flushCache();
}
}
public function setBarColor($color)
{
$this->color = $color;
@@ -388,7 +388,7 @@ class ProgressBar
$this->_flushCache();
}
}
public function setBarBackground($color)
{
$this->bgr_color = $color;
@@ -398,15 +398,15 @@ class ProgressBar
$this->_flushCache();
}
}
public function setBarDirection($direction)
{
$this->direction = $direction;
if ($this->status != 'new')
{
$this->position = $this->_calculatePosition($this->step);
echo '<script type="text/JavaScript">';
echo 'PBposition'.$this->code.'("left",'.$this->position['left'].');';
echo 'PBposition'.$this->code.'("top",'.$this->position['top'].');';
@@ -416,13 +416,13 @@ class ProgressBar
$this->_flushCache();
}
}
public function getHtml()
{
$html = '';
$js = '';
$html_button = '';
$this->_setStep($this->step);
$this->position = $this->_calculatePosition($this->step);
@@ -432,7 +432,7 @@ class ProgressBar
$style_brd = 'width:'.$this->width.'px;height:'.$this->height.'px;background:'.$this->bgr_color.';';
if ($this->border > 0)
$style_brd .= 'border:'.$this->border.'px solid; border-color:'.$this->brd_color.'; -webkit-border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px; -webkit-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset;';
$style_bar = 'position:relative;width:'.$this->position['width'].'px;height:'.$this->position['height'].'px;background:'.$this->color.';';
if ($this->position['top'] !== false)
$style_bar .= 'top:'.$this->position['top'].'px;';
@@ -440,7 +440,7 @@ class ProgressBar
$style_bar .= 'left:'.$this->position['left'].'px;';
if ($this->border > 0)
$style_bar .= '-webkit-border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px; -webkit-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset;';
if ($this->frame['show'] == true)
{
if ($this->frame['border'] > 0)
@@ -448,12 +448,12 @@ class ProgressBar
$html .= '<div id="pfrm'.$this->code.'" style="width:'.$this->frame['width'].'px;height:'.$this->frame['height'].'px;'.$border.'background:'.$this->frame['color'].';">'."\n";
}
// temp write the bar here, we add that later, below all the html + progress %
// temp write the bar here, we add that later, below all the html + progress %
$html_bar_top = '<div id="pbrd'.$this->code.'" style="'.$style_brd.($this->frame['show'] == true ? 'margin-left: 2px;margin-bottom:2px;' : '').'">'."\n";
$html_bar_top .= '<div id="pbar'.$this->code.'" style="'.$style_bar.'">';
// insert single percent there
$html_bar_bottom = '</div></div>'."\n";
$js .= 'function PBposition'.$this->code.'(item,pixel) {'."\n";
$js .= ' pixel = parseInt(pixel);'."\n";
$js .= ' switch(item) {'."\n";
@@ -479,7 +479,7 @@ class ProgressBar
$style_lbl .= 'width:'.$data['width'].'px;';
if ($data['height'] > 0)
$style_lbl .= 'height:'.$data['height'].'px;';
if (array_key_exists('font-size', $data))
$style_lbl .= 'font-size:'.$data['font-size'].'px;';
if (array_key_exists('font-family', $data))
@@ -488,7 +488,7 @@ class ProgressBar
$style_lbl .= 'font-weight:'.$data['font-weight'].';';
if (array_key_exists('bgr_color', $data) && ($data['bgr_color'] != ''))
$style_lbl .= 'background:'.$data['bgr_color'].';';
if (array_key_exists('type', $data))
{
switch ($data['type'])
@@ -513,7 +513,7 @@ class ProgressBar
break;
case 'crossbar':
$html .= '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'">'.$data['value'].'</div>'."\n";
$js .= 'function PBrotaryCross'.$name.$this->code.'() {'."\n";
$js .= ' cross = document.getElementById("plbl'.$name.$this->code.'").firstChild.nodeValue;'."\n";
$js .= ' switch(cross) {'."\n";
@@ -534,42 +534,42 @@ class ProgressBar
$html .= $html_percent;
$html .= $html_bar_bottom;
$html .= $html_button; // any buttons on bottom
if (count($this->label) > 0)
{
$js .= 'function PBlabelText'.$this->code.'(name,text) {'."\n";
$js .= ' name = "plbl" + name + "'.$this->code.'";'."\n";
$js .= ' document.getElementById(name).innerHTML=text;'."\n";
$js .= '}'."\n";
}
if ($this->frame['show'] == true)
{
$html .= '</div>'."\n";
}
$html .= '<script type="text/JavaScript">'."\n";
$html .= $js;
$html .= '</script>'."\n";
$html .= '</div>';
return $html;
}
public function show()
{
$this->status = 'show';
echo $this->getHtml();
$this->_flushCache();
}
public function moveStep($step)
{
$last_step = $this->step;
$this->_setStep($step);
$js = '';
$new_position = $this->_calculatePosition($this->step);
if ($new_position['width'] != $this->position['width'] && ($this->direction == 'right' || $this->direction == 'left'))
@@ -621,37 +621,37 @@ class ProgressBar
$this->_flushCache();
}
}
public function moveNext()
{
$this->moveStep($this->step + 1);
}
public function moveMin()
{
$this->moveStep($this->min);
}
public function hide()
{
if ($this->status == 'show')
{
$this->status = 'hide';
$output = '<script type="text/JavaScript">';
$output .= 'document.getElementById("pbm'.$this->code.'").style.visibility="hidden";document.getElementById("pbm'.$this->code.'").style.display="none";';
$output .= '</script>'."\n";
$output .= '</script>'."\n";
echo $output;
$this->_flushCache();
}
}
public function unhide()
{
if ($this->status == 'hide')
{
$this->status = 'show';
$output = '<script type="text/JavaScript">';
$output .= 'document.getElementById("pbm'.$this->code.'").style.visibility="visible";document.getElementById("pbm'.$this->code.'").style.visibility="block";';
$output .= '</script>'."\n";
@@ -659,6 +659,6 @@ class ProgressBar
$this->_flushCache();
}
}
}
?>

View File

@@ -11,9 +11,9 @@
* I changed that to a class to be more portable with my style of coding
*
* PUBLIC VARIABLES
*
*
* PRIVATE VARIABLES
*
*
* PUBLIC METHODS
* __: returns string (translated or original if not found)
* _e: echos out string (translated or original if not found)

View File

@@ -1,7 +1,7 @@
<?
/*********************************************************************
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
* CREATED: 2003/04/09
* CREATED: 2003/04/09
* SHORT DESCRIPTION:
* pgsql wrapper calls
* HISTORY:
@@ -147,7 +147,7 @@
{
return pg_num_fields($cursor);
}
// METHOD: _db_field_name
// PARAMS: cursor, field position
// RETURN: name of field
@@ -185,7 +185,7 @@
// DESC : wrapper for pg_affected_rows
public function _db_affected_rows($cursor)
{
return pg_affected_rows($cursor);
return pg_affected_rows($cursor);
}
// METHOD: _db_insert_id
@@ -355,7 +355,7 @@
{
return pg_connection_busy($this->dbh);
}
// METHOD: _db_version
// PARAMS: none
// RETURN: databse version

View File

@@ -33,7 +33,7 @@
else
return false;
}
// METHOD: _db_query
// PARAMS: query
// RETURN: cursor
@@ -99,7 +99,7 @@
}
$this->dbh = null;
}
// METHOD: _db_prepare
// PARAMS: prepare name, query
// RETURN: prepared statement handler
@@ -140,7 +140,7 @@
// return pg_num_fields($cursor);
return $cursor->columnCount();
}
// METHOD: _db_field_name
// PARAMS: cursor, field position
// RETURN: name of field
@@ -166,7 +166,7 @@
// DESC : wrapper for pg_affected_rows
public function _db_affected_rows($cursor)
{
// return pg_affected_rows($cursor);
// return pg_affected_rows($cursor);
return $cusor->rowCount();
}
@@ -278,7 +278,7 @@
{
$db_port = 5432;
}
try
try
{
$this->dbh = new PDO('pgsql:host='.$db_host.';dbname='.$db_name.';port='.$db_port.';sslmode='.$db_ssl, $db_user, $db_pass);
}
@@ -342,7 +342,7 @@
{
// return pg_connection_busy($this->dbh);
}
// METHOD: _db_version
// PARAMS: none
// RETURN: databse version