Browse Source

Code formatting

master
Anton Terekhov 13 years ago
parent
commit
3ebfac9db4
  1. 2
      app/Action.php
  2. 5
      app/AjaxAction.php
  3. 7
      app/PagerAction.php
  4. 2
      app/StaticAction.php
  5. 5
      cache/CacheKey.php
  6. 1
      cache/Cacher.php
  7. 10
      captcha/Captcha.php
  8. 12
      exception/ErrorHandler.php

2
app/Action.php

@ -51,7 +51,7 @@ abstract class Action
protected function getTemplate()
{
$class = get_class($this);
$template = ($this->template) ? $this->template : substr($class, 0, -6/*strlen('Action')*/);
$template = ($this->template) ? $this->template : substr($class, 0, -6 /*strlen('Action')*/);
$dir = array_slice(explode('/', Load::getFilePath($class)), -2, 1);
return '/actions/' . array_pop($dir) . '/' . $template;
}

5
app/AjaxAction.php

@ -12,11 +12,12 @@
*/
/**
* базовый класс для всей экшенов выполняющихся по аякс-запросу
*/
* базовый класс для всей экшенов выполняющихся по аякс-запросу
*/
abstract class AjaxAction extends Action
{
public $data = 1;
protected $encode = true;
function __construct()

7
app/PagerAction.php

@ -11,9 +11,12 @@
class PagerAction extends Action
{
public $page = 1;
public $page = 1;
public $last_page = 1;
protected $offset = 0;
protected $limit;
public function __construct($limit = 20)
@ -48,7 +51,7 @@ class PagerAction extends Action
protected function getTemplate()
{
$template = ($this->template) ? $this->template : substr(get_class($this), 0, -6/*strlen('Action')*/);
$template = ($this->template) ? $this->template : substr(get_class($this), 0, -6 /*strlen('Action')*/);
return '/actions/' . $template;
}
}

2
app/StaticAction.php

@ -14,7 +14,7 @@ abstract class StaticAction extends Action
protected function getTemplate()
{
$template = ($this->template) ? $this->template : substr(get_class($this), 0, -6/*strlen('Action')*/);
$template = ($this->template) ? $this->template : substr(get_class($this), 0, -6 /*strlen('Action')*/);
return '/static/' . $template;
}

5
cache/CacheKey.php

@ -21,6 +21,7 @@ class CacheKey
* @var CacheKey
*/
protected $key;
protected $expire = 0;
/**
@ -32,11 +33,11 @@ class CacheKey
*/
public function __construct($cacher, $key, $params = array(), $expire = 0)
{
$this->cacher = $cacher;
$this->cacher = $cacher;
$this->key = $key;
if ($params) {
$params = (is_array($params)) ? implode('|', $params) : $params;
$this->key = $key . '_' . $params;
$this->key = $key . '_' . $params;
}
$this->expire = $expire;
}

1
cache/Cacher.php

@ -19,7 +19,6 @@ class Cacher
*/
static protected $caches = array();
static public function get($cacher, $config = null)
{
if (!isset(self::$caches[$cacher])) {

10
captcha/Captcha.php

@ -13,8 +13,10 @@ class Captcha
{
protected $font_size = 38;
protected $width = 200;
protected $height = 70;
protected $width = 200;
protected $height = 70;
public function getImage($token)
@ -48,7 +50,7 @@ class Captcha
imagettftext($image, $this->font_size, 0,
rand($i + 2, $i + 4), ($this->font_size + $this->height) / 2,
$color, $font, $letter);
$i = $i + $step ;
$i = $i + $step;
}
}
@ -71,7 +73,7 @@ class Captcha
public function checkCode($token, $code)
{
if (Session::get('_ctoken') == $token && Session::get('_ccode') == strtoupper($code)){
if (Session::get('_ctoken') == $token && Session::get('_ccode') == strtoupper($code)) {
// Housekeeping
Session::del('_ccode');
Session::del('_ctoken');

12
exception/ErrorHandler.php

@ -17,7 +17,7 @@ class ErrorHandler
set_error_handler(array('ErrorHandler', 'error_handler'));
}
static public function error_handler($errno, $errstr, $errfile, $errline )
static public function error_handler($errno, $errstr, $errfile, $errline)
{
ob_clean();
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
@ -28,16 +28,16 @@ class ErrorHandler
{
$code = array();
$i = 0;
foreach(file($file) as $line) {
foreach (file($file) as $line) {
$i++;
if($i >= $hiline - 10 && $i <= $hiline + 10) {
if ($i >= $hiline - 10 && $i <= $hiline + 10) {
if ($i == $hiline) {
$code[] = '<tr class="error"><th>' . $i . '</th><td><span class="specific">' . htmlentities($line, ENT_QUOTES, 'UTF-8') . '</span></td></tr>';
}else{
} else {
$code[] = '<tr><th>' . $i . '</th><td>' . htmlentities($line, ENT_QUOTES, 'UTF-8') . '</td></tr>';
}
}
if($i > $hiline + 10) {
if ($i > $hiline + 10) {
break;
}
}
@ -88,7 +88,7 @@ class ErrorHandler
$cookies = self::wrapArray(Env::Cookie(), 'COOKIE');
$server = self::wrapArray(Env::Server(), 'SERVER');
$message =<<<EOD
$message = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

Loading…
Cancel
Save