Skip to content

Commit

Permalink
Use camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
neeckeloo committed Jan 7, 2013
1 parent 5b80e06 commit c3f4f17
Show file tree
Hide file tree
Showing 26 changed files with 373 additions and 376 deletions.
54 changes: 27 additions & 27 deletions library/Zend/Captcha/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ protected function generateImage($id, $word)
$h = $this->getHeight();
$fsize = $this->getFontSize();

$img_file = $this->getImgDir() . $id . $this->getSuffix();
$imgFile = $this->getImgDir() . $id . $this->getSuffix();

if (empty($this->startImage)) {
$img = imagecreatetruecolor($w, $h);
Expand All @@ -508,26 +508,26 @@ protected function generateImage($id, $word)
$h = imagesy($img);
}

$text_color = imagecolorallocate($img, 0, 0, 0);
$bg_color = imagecolorallocate($img, 255, 255, 255);
imagefilledrectangle($img, 0, 0, $w-1, $h-1, $bg_color);
$textColor = imagecolorallocate($img, 0, 0, 0);
$bgColor = imagecolorallocate($img, 255, 255, 255);
imagefilledrectangle($img, 0, 0, $w-1, $h-1, $bgColor);
$textbox = imageftbbox($fsize, 0, $font, $word);
$x = ($w - ($textbox[2] - $textbox[0])) / 2;
$y = ($h - ($textbox[7] - $textbox[1])) / 2;
imagefttext($img, $fsize, 0, $x, $y, $text_color, $font, $word);
imagefttext($img, $fsize, 0, $x, $y, $textColor, $font, $word);

// generate noise
for ($i=0; $i < $this->dotNoiseLevel; $i++) {
imagefilledellipse($img, mt_rand(0, $w), mt_rand(0, $h), 2, 2, $text_color);
imagefilledellipse($img, mt_rand(0, $w), mt_rand(0, $h), 2, 2, $textColor);
}
for ($i=0; $i < $this->lineNoiseLevel; $i++) {
imageline($img, mt_rand(0, $w), mt_rand(0, $h), mt_rand(0, $w), mt_rand(0, $h), $text_color);
imageline($img, mt_rand(0, $w), mt_rand(0, $h), mt_rand(0, $w), mt_rand(0, $h), $textColor);
}

// transformed image
$img2 = imagecreatetruecolor($w, $h);
$bg_color = imagecolorallocate($img2, 255, 255, 255);
imagefilledrectangle($img2, 0, 0, $w-1, $h-1, $bg_color);
$bgColor = imagecolorallocate($img2, 255, 255, 255);
imagefilledrectangle($img2, 0, 0, $w-1, $h-1, $bgColor);

// apply wave transforms
$freq1 = $this->randomFreq();
Expand All @@ -551,29 +551,29 @@ protected function generateImage($id, $word)
if ($sx < 0 || $sy < 0 || $sx >= $w - 1 || $sy >= $h - 1) {
continue;
} else {
$color = (imagecolorat($img, $sx, $sy) >> 16) & 0xFF;
$color_x = (imagecolorat($img, $sx + 1, $sy) >> 16) & 0xFF;
$color_y = (imagecolorat($img, $sx, $sy + 1) >> 16) & 0xFF;
$color_xy = (imagecolorat($img, $sx + 1, $sy + 1) >> 16) & 0xFF;
$color = (imagecolorat($img, $sx, $sy) >> 16) & 0xFF;
$colorX = (imagecolorat($img, $sx + 1, $sy) >> 16) & 0xFF;
$colorY = (imagecolorat($img, $sx, $sy + 1) >> 16) & 0xFF;
$colorXY = (imagecolorat($img, $sx + 1, $sy + 1) >> 16) & 0xFF;
}

if ($color == 255 && $color_x == 255 && $color_y == 255 && $color_xy == 255) {
if ($color == 255 && $colorX == 255 && $colorY == 255 && $colorXY == 255) {
// ignore background
continue;
} elseif ($color == 0 && $color_x == 0 && $color_y == 0 && $color_xy == 0) {
} elseif ($color == 0 && $colorX == 0 && $colorY == 0 && $colorXY == 0) {
// transfer inside of the image as-is
$newcolor = 0;
} else {
// do antialiasing for border items
$frac_x = $sx-floor($sx);
$frac_y = $sy-floor($sy);
$frac_x1 = 1-$frac_x;
$frac_y1 = 1-$frac_y;

$newcolor = $color * $frac_x1 * $frac_y1
+ $color_x * $frac_x * $frac_y1
+ $color_y * $frac_x1 * $frac_y
+ $color_xy * $frac_x * $frac_y;
$fracX = $sx - floor($sx);
$fracY = $sy - floor($sy);
$fracX1 = 1 - $fracX;
$fracY1 = 1 - $fracY;

$newcolor = $color * $fracX1 * $fracY1
+ $colorX * $fracX * $fracY1
+ $colorY * $fracX1 * $fracY
+ $colorXY * $fracX * $fracY;
}

imagesetpixel($img2, $x, $y, imagecolorallocate($img2, $newcolor, $newcolor, $newcolor));
Expand All @@ -582,14 +582,14 @@ protected function generateImage($id, $word)

// generate noise
for ($i=0; $i<$this->dotNoiseLevel; $i++) {
imagefilledellipse($img2, mt_rand(0, $w), mt_rand(0, $h), 2, 2, $text_color);
imagefilledellipse($img2, mt_rand(0, $w), mt_rand(0, $h), 2, 2, $textColor);
}

for ($i=0; $i<$this->lineNoiseLevel; $i++) {
imageline($img2, mt_rand(0, $w), mt_rand(0, $h), mt_rand(0, $w), mt_rand(0, $h), $text_color);
imageline($img2, mt_rand(0, $w), mt_rand(0, $h), mt_rand(0, $w), mt_rand(0, $h), $textColor);
}

imagepng($img2, $img_file);
imagepng($img2, $imgFile);
imagedestroy($img);
imagedestroy($img2);
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Console/Getopt.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ public function setAliases($aliasMap)
/**
* Define help messages for options.
*
* The parameter $help_map is an associative array
* The parameter $helpMap is an associative array
* mapping option name (short or long) to the help string.
*
* @param array $helpMap
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Feed/Reader/Entry/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public function getAuthors()
}

$authors = array();
$authors_dc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authors_dc)) {
foreach ($authors_dc as $author) {
$authorsDc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authorsDc)) {
foreach ($authorsDc as $author) {
$authors[] = array(
'name' => $author['name']
);
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Feed/Reader/Feed/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public function getAuthors()
}

$authors = array();
$authors_dc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authors_dc)) {
foreach ($authors_dc as $author) {
$authorsDc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authorsDc)) {
foreach ($authorsDc as $author) {
$authors[] = array(
'name' => $author['name']
);
Expand Down
16 changes: 8 additions & 8 deletions library/Zend/Feed/Reader/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public static function import($uri, $etag = null, $lastModified = null)
*/
public static function importString($string)
{
$libxml_errflag = libxml_use_internal_errors(true);
$libxmlErrflag = libxml_use_internal_errors(true);
$oldValue = libxml_disable_entity_loader(true);
$dom = new DOMDocument;
$status = $dom->loadXML(trim($string));
Expand All @@ -281,7 +281,7 @@ public static function importString($string)
}
}
libxml_disable_entity_loader($oldValue);
libxml_use_internal_errors($libxml_errflag);
libxml_use_internal_errors($libxmlErrflag);

if (!$status) {
// Build error message
Expand Down Expand Up @@ -346,12 +346,12 @@ public static function findFeedLinks($uri)
throw new Exception\RuntimeException("Failed to access $uri, got response code " . $response->getStatusCode());
}
$responseHtml = $response->getBody();
$libxml_errflag = libxml_use_internal_errors(true);
$libxmlErrflag = libxml_use_internal_errors(true);
$oldValue = libxml_disable_entity_loader(true);
$dom = new DOMDocument;
$status = $dom->loadHTML(trim($responseHtml));
libxml_disable_entity_loader($oldValue);
libxml_use_internal_errors($libxml_errflag);
libxml_use_internal_errors($libxmlErrflag);
if (!$status) {
// Build error message
$error = libxml_get_last_error();
Expand Down Expand Up @@ -401,14 +401,14 @@ public static function detectType($feed, $specOnly = false)
ini_restore('track_errors');
ErrorHandler::stop();
if (!$status) {
if (!isset($php_errormsg)) {
if (!isset($phpErrormsg)) {
if (function_exists('xdebug_is_enabled')) {
$php_errormsg = '(error message not available, when XDebug is running)';
$phpErrormsg = '(error message not available, when XDebug is running)';
} else {
$php_errormsg = '(error message not available)';
$phpErrormsg = '(error message not available)';
}
}
throw new Exception\RuntimeException("DOMDocument cannot parse XML: $php_errormsg");
throw new Exception\RuntimeException("DOMDocument cannot parse XML: $phpErrormsg");
}
} else {
throw new Exception\InvalidArgumentException('Invalid object/scalar provided: must'
Expand Down
14 changes: 7 additions & 7 deletions library/Zend/Form/Annotation/AllowEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* AllowEmpty annotation
*
* Presence of this annotation is a hint that the associated
* \Zend\InputFilter\Input should enable the allow_empty flag.
* \Zend\InputFilter\Input should enable the allowEmpty flag.
*
* @Annotation
* @package Zend_Form
Expand All @@ -27,7 +27,7 @@ class AllowEmpty
/**
* @var bool
*/
protected $allow_empty = true;
protected $allowEmpty = true;

/**
* Receive and process the contents of an annotation
Expand All @@ -40,14 +40,14 @@ public function __construct(array $data)
$data['value'] = false;
}

$allow_empty = $data['value'];
$allowEmpty = $data['value'];

if (!is_bool($allow_empty)) {
if (!is_bool($allowEmpty)) {
$filter = new BooleanFilter();
$allow_empty = $filter->filter($allow_empty);
$allowEmpty = $filter->filter($allowEmpty);
}

$this->allow_empty = $allow_empty;
$this->allowEmpty = $allowEmpty;
}

/**
Expand All @@ -57,6 +57,6 @@ public function __construct(array $data)
*/
public function getAllowEmpty()
{
return $this->allow_empty;
return $this->allowEmpty;
}
}
4 changes: 2 additions & 2 deletions library/Zend/Http/Client/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public function connect($host, $port = 80, $secure = false);
*
* @param string $method
* @param \Zend\Uri\Uri $url
* @param string $http_ver
* @param string $httpVer
* @param array $headers
* @param string $body
* @return string Request as text
*/
public function write($method, $url, $http_ver = '1.1', $headers = array(), $body = '');
public function write($method, $url, $httpVer = '1.1', $headers = array(), $body = '');

/**
* Read response from server
Expand Down
20 changes: 10 additions & 10 deletions library/Zend/Http/Client/Adapter/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ public function connect($host, $port = 80, $secure = false)
*
* @param string $method
* @param \Zend\Uri\Uri $uri
* @param string $http_ver
* @param string $httpVer
* @param array $headers
* @param string $body
* @throws AdapterException\RuntimeException
* @return string Request as string
*/
public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
public function write($method, $uri, $httpVer = '1.1', $headers = array(), $body = '')
{
// If no proxy is set, fall back to default Socket adapter
if (! $this->config['proxy_host']) return parent::write($method, $uri, $http_ver, $headers, $body);
if (! $this->config['proxy_host']) return parent::write($method, $uri, $httpVer, $headers, $body);

// Make sure we're properly connected
if (! $this->socket) {
Expand All @@ -132,7 +132,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
$host = $this->config['proxy_host'];
$port = $this->config['proxy_port'];

if ($this->connected_to[0] != "tcp://$host" || $this->connected_to[1] != $port) {
if ($this->connectedTo[0] != "tcp://$host" || $this->connectedTo[1] != $port) {
throw new AdapterException\RuntimeException("Trying to write but we are connected to the wrong proxy server");
}

Expand All @@ -145,7 +145,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod

// if we are proxying HTTPS, preform CONNECT handshake with the proxy
if ($uri->getScheme() == 'https' && (! $this->negotiated)) {
$this->connectHandshake($uri->getHost(), $uri->getPort(), $http_ver, $headers);
$this->connectHandshake($uri->getHost(), $uri->getPort(), $httpVer, $headers);
$this->negotiated = true;
}

Expand All @@ -158,9 +158,9 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
if ($uri->getQuery()) {
$path .= '?' . $uri->getQuery();
}
$request = "$method $path HTTP/$http_ver\r\n";
$request = "$method $path HTTP/$httpVer\r\n";
} else {
$request = "$method $uri HTTP/$http_ver\r\n";
$request = "$method $uri HTTP/$httpVer\r\n";
}

// Add all headers to the request string
Expand Down Expand Up @@ -198,13 +198,13 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
*
* @param string $host
* @param integer $port
* @param string $http_ver
* @param string $httpVer
* @param array $headers
* @throws AdapterException\RuntimeException
*/
protected function connectHandshake($host, $port = 443, $http_ver = '1.1', array &$headers = array())
protected function connectHandshake($host, $port = 443, $httpVer = '1.1', array &$headers = array())
{
$request = "CONNECT $host:$port HTTP/$http_ver\r\n" .
$request = "CONNECT $host:$port HTTP/$httpVer\r\n" .
"Host: " . $this->config['proxy_host'] . "\r\n";

// Add the user-agent header
Expand Down
Loading

0 comments on commit c3f4f17

Please sign in to comment.