@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public function read($bytesRequested) |
62 | 62 | { |
63 | - return fread($this->_fileHandle, $bytesRequested); |
|
63 | + return fread($this->_fileHandle, $bytesRequested); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
@@ -136,19 +136,19 @@ |
||
136 | 136 | public function read($bytesRequested) |
137 | 137 | { |
138 | 138 | if($this->_currentPart >= count($this->_parts)) { |
139 | - return FALSE; |
|
139 | + return FALSE; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $activePart = $this->_parts[$this->_currentPart]; |
143 | 143 | $buffer = $activePart->read($bytesRequested); |
144 | 144 | |
145 | 145 | while(strlen($buffer) < $bytesRequested) { |
146 | - $this->_currentPart += 1; |
|
147 | - $nextBuffer = $this->read($bytesRequested - strlen($buffer)); |
|
148 | - if($nextBuffer === FALSE) { |
|
146 | + $this->_currentPart += 1; |
|
147 | + $nextBuffer = $this->read($bytesRequested - strlen($buffer)); |
|
148 | + if($nextBuffer === FALSE) { |
|
149 | 149 | break; |
150 | - } |
|
151 | - $buffer .= $nextBuffer; |
|
150 | + } |
|
151 | + $buffer .= $nextBuffer; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | return $buffer; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->_fileHandle = fopen($filePath, 'rb', TRUE); |
101 | - $this->_boundaryString = '=_' . md5(microtime(1) . rand(1,20)); |
|
101 | + $this->_boundaryString = '=_' . md5(microtime(1) . rand(1, 20)); |
|
102 | 102 | $entry = $this->wrapEntry($xmlString, $fileContentType); |
103 | 103 | $closingBoundary = new Zend_Gdata_MimeBodyString("\r\n--{$this->_boundaryString}--\r\n"); |
104 | 104 | $file = new Zend_Gdata_MimeFile($this->_fileHandle); |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function read($bytesRequested) |
137 | 137 | { |
138 | - if($this->_currentPart >= count($this->_parts)) { |
|
138 | + if ($this->_currentPart >= count($this->_parts)) { |
|
139 | 139 | return FALSE; |
140 | 140 | } |
141 | 141 | |
142 | 142 | $activePart = $this->_parts[$this->_currentPart]; |
143 | 143 | $buffer = $activePart->read($bytesRequested); |
144 | 144 | |
145 | - while(strlen($buffer) < $bytesRequested) { |
|
145 | + while (strlen($buffer) < $bytesRequested) { |
|
146 | 146 | $this->_currentPart += 1; |
147 | 147 | $nextBuffer = $this->read($bytesRequested - strlen($buffer)); |
148 | - if($nextBuffer === FALSE) { |
|
148 | + if ($nextBuffer === FALSE) { |
|
149 | 149 | break; |
150 | 150 | } |
151 | 151 | $buffer .= $nextBuffer; |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '') |
59 | 59 | { |
60 | 60 | // If no proxy is set, throw an error |
61 | - if (! $this->config['proxy_host']) { |
|
61 | + if (!$this->config['proxy_host']) { |
|
62 | 62 | require_once 'Zend/Http/Client/Adapter/Exception.php'; |
63 | 63 | throw new Zend_Http_Client_Adapter_Exception('No proxy host set!'); |
64 | 64 | } |
65 | 65 | |
66 | 66 | // Make sure we're properly connected |
67 | - if (! $this->socket) { |
|
67 | + if (!$this->socket) { |
|
68 | 68 | require_once 'Zend/Http/Client/Adapter/Exception.php'; |
69 | 69 | throw new Zend_Http_Client_Adapter_Exception( |
70 | 70 | 'Trying to write but we are not connected'); |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Add Proxy-Authorization header |
84 | - if ($this->config['proxy_user'] && ! isset($headers['proxy-authorization'])) { |
|
84 | + if ($this->config['proxy_user'] && !isset($headers['proxy-authorization'])) { |
|
85 | 85 | $headers['proxy-authorization'] = Zend_Http_Client::encodeAuthHeader( |
86 | 86 | $this->config['proxy_user'], $this->config['proxy_pass'], $this->config['proxy_auth'] |
87 | 87 | ); |
88 | 88 | } |
89 | 89 | |
90 | 90 | // if we are proxying HTTPS, preform CONNECT handshake with the proxy |
91 | - if ($uri->getScheme() == 'https' && (! $this->negotiated)) { |
|
91 | + if ($uri->getScheme() == 'https' && (!$this->negotiated)) { |
|
92 | 92 | $this->connectHandshake($uri->getHost(), $uri->getPort(), $http_ver, $headers); |
93 | 93 | $this->negotiated = true; |
94 | 94 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $request .= "\r\n"; |
109 | 109 | |
110 | 110 | // Send the request headers |
111 | - if (! @fwrite($this->socket, $request)) { |
|
111 | + if (!@fwrite($this->socket, $request)) { |
|
112 | 112 | require_once 'Zend/Http/Client/Adapter/Exception.php'; |
113 | 113 | throw new Zend_Http_Client_Adapter_Exception( |
114 | 114 | 'Error writing request to proxy server'); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | //read from $body, write to socket |
118 | 118 | while ($body->hasData()) { |
119 | - if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) { |
|
119 | + if (!@fwrite($this->socket, $body->read(self::CHUNK_SIZE))) { |
|
120 | 120 | require_once 'Zend/Http/Client/Adapter/Exception.php'; |
121 | 121 | throw new Zend_Http_Client_Adapter_Exception( |
122 | 122 | 'Error writing request to server'); |
@@ -101,7 +101,9 @@ |
||
101 | 101 | |
102 | 102 | // Add all headers to the request string |
103 | 103 | foreach ($headers as $k => $v) { |
104 | - if (is_string($k)) $v = "$k: $v"; |
|
104 | + if (is_string($k)) { |
|
105 | + $v = "$k: $v"; |
|
106 | + } |
|
105 | 107 | $request .= "$v\r\n"; |
106 | 108 | } |
107 | 109 |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function getCalendarListFeed() |
136 | 136 | { |
137 | 137 | $uri = self::CALENDAR_FEED_URI . '/default'; |
138 | - return parent::getFeed($uri,'Zend_Gdata_Calendar_ListFeed'); |
|
138 | + return parent::getFeed($uri, 'Zend_Gdata_Calendar_ListFeed'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | } else { |
155 | 155 | $uri = $location; |
156 | 156 | } |
157 | - return parent::getEntry($uri,'Zend_Gdata_Calendar_ListEntry'); |
|
157 | + return parent::getEntry($uri, 'Zend_Gdata_Calendar_ListEntry'); |
|
158 | 158 | } |
159 | 159 | |
160 | - public function insertEvent($event, $uri=null) |
|
160 | + public function insertEvent($event, $uri = null) |
|
161 | 161 | { |
162 | 162 | if ($uri == null) { |
163 | 163 | $uri = $this->_defaultPostUri; |
@@ -54,37 +54,37 @@ discard block |
||
54 | 54 | |
55 | 55 | const AUTHSUB_TOKEN_INFO_URI = 'https://www.google.com/accounts/AuthSubTokenInfo'; |
56 | 56 | |
57 | - /** |
|
58 | - * Creates a URI to request a single-use AuthSub token. |
|
59 | - * |
|
60 | - * @param string $next (required) URL identifying the service to be |
|
61 | - * accessed. |
|
62 | - * The resulting token will enable access to the specified service only. |
|
63 | - * Some services may limit scope further, such as read-only access. |
|
64 | - * @param string $scope (required) URL identifying the service to be |
|
65 | - * accessed. The resulting token will enable |
|
66 | - * access to the specified service only. |
|
67 | - * Some services may limit scope further, such |
|
68 | - * as read-only access. |
|
69 | - * @param int $secure (optional) Boolean flag indicating whether the |
|
70 | - * authentication transaction should issue a secure |
|
71 | - * token (1) or a non-secure token (0). Secure tokens |
|
72 | - * are available to registered applications only. |
|
73 | - * @param int $session (optional) Boolean flag indicating whether |
|
74 | - * the one-time-use token may be exchanged for |
|
75 | - * a session token (1) or not (0). |
|
76 | - * @param string $request_uri (optional) URI to which to direct the |
|
77 | - * authentication request. |
|
78 | - */ |
|
79 | - public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0, |
|
80 | - $request_uri = self::AUTHSUB_REQUEST_URI) |
|
81 | - { |
|
82 | - $querystring = '?next=' . urlencode($next) |
|
83 | - . '&scope=' . urldecode($scope) |
|
84 | - . '&secure=' . urlencode($secure) |
|
85 | - . '&session=' . urlencode($session); |
|
86 | - return $request_uri . $querystring; |
|
87 | - } |
|
57 | + /** |
|
58 | + * Creates a URI to request a single-use AuthSub token. |
|
59 | + * |
|
60 | + * @param string $next (required) URL identifying the service to be |
|
61 | + * accessed. |
|
62 | + * The resulting token will enable access to the specified service only. |
|
63 | + * Some services may limit scope further, such as read-only access. |
|
64 | + * @param string $scope (required) URL identifying the service to be |
|
65 | + * accessed. The resulting token will enable |
|
66 | + * access to the specified service only. |
|
67 | + * Some services may limit scope further, such |
|
68 | + * as read-only access. |
|
69 | + * @param int $secure (optional) Boolean flag indicating whether the |
|
70 | + * authentication transaction should issue a secure |
|
71 | + * token (1) or a non-secure token (0). Secure tokens |
|
72 | + * are available to registered applications only. |
|
73 | + * @param int $session (optional) Boolean flag indicating whether |
|
74 | + * the one-time-use token may be exchanged for |
|
75 | + * a session token (1) or not (0). |
|
76 | + * @param string $request_uri (optional) URI to which to direct the |
|
77 | + * authentication request. |
|
78 | + */ |
|
79 | + public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0, |
|
80 | + $request_uri = self::AUTHSUB_REQUEST_URI) |
|
81 | + { |
|
82 | + $querystring = '?next=' . urlencode($next) |
|
83 | + . '&scope=' . urldecode($scope) |
|
84 | + . '&secure=' . urlencode($secure) |
|
85 | + . '&session=' . urlencode($session); |
|
86 | + return $request_uri . $querystring; |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | 90 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @throws Zend_Gdata_App_HttpException |
151 | 151 | */ |
152 | 152 | public static function AuthSubRevokeToken($token, $client = null, |
153 | - $request_uri = self::AUTHSUB_REVOKE_TOKEN_URI) |
|
153 | + $request_uri = self::AUTHSUB_REVOKE_TOKEN_URI) |
|
154 | 154 | { |
155 | 155 | $client = self::getHttpClient($token, $client); |
156 | 156 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | class Zend_Gdata_AuthSub |
47 | 47 | { |
48 | 48 | |
49 | - const AUTHSUB_REQUEST_URI = 'https://www.google.com/accounts/AuthSubRequest'; |
|
49 | + const AUTHSUB_REQUEST_URI = 'https://www.google.com/accounts/AuthSubRequest'; |
|
50 | 50 | |
51 | 51 | const AUTHSUB_SESSION_TOKEN_URI = 'https://www.google.com/accounts/AuthSubSessionToken'; |
52 | 52 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string $request_uri (optional) URI to which to direct the |
77 | 77 | * authentication request. |
78 | 78 | */ |
79 | - public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0, |
|
79 | + public static function getAuthSubTokenUri($next, $scope, $secure = 0, $session = 0, |
|
80 | 80 | $request_uri = self::AUTHSUB_REQUEST_URI) |
81 | 81 | { |
82 | 82 | $querystring = '?next=' . urlencode($next) |
@@ -95,14 +95,14 @@ |
||
95 | 95 | protected function takeAttributeFromDOM($attribute) |
96 | 96 | { |
97 | 97 | switch ($attribute->localName) { |
98 | - case 'scheme': |
|
99 | - $this->_scheme = $attribute->nodeValue; |
|
100 | - break; |
|
101 | - case 'label': |
|
102 | - $this->_label = $attribute->nodeValue; |
|
103 | - break; |
|
104 | - default: |
|
105 | - parent::takeAttributeFromDOM($attribute); |
|
98 | + case 'scheme': |
|
99 | + $this->_scheme = $attribute->nodeValue; |
|
100 | + break; |
|
101 | + case 'label': |
|
102 | + $this->_label = $attribute->nodeValue; |
|
103 | + break; |
|
104 | + default: |
|
105 | + parent::takeAttributeFromDOM($attribute); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -323,9 +323,9 @@ |
||
323 | 323 | $title->transferFromDOM($child); |
324 | 324 | $this->_title = $title; |
325 | 325 | break; |
326 | - default: |
|
327 | - parent::takeChildFromDOM($child); |
|
328 | - break; |
|
326 | + default: |
|
327 | + parent::takeChildFromDOM($child); |
|
328 | + break; |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 |
@@ -86,11 +86,11 @@ |
||
86 | 86 | protected function takeAttributeFromDOM($attribute) |
87 | 87 | { |
88 | 88 | switch ($attribute->localName) { |
89 | - case 'algo': |
|
90 | - $this->_algo = $attribute->nodeValue; |
|
91 | - break; |
|
92 | - default: |
|
93 | - parent::takeAttributeFromDOM($attribute); |
|
89 | + case 'algo': |
|
90 | + $this->_algo = $attribute->nodeValue; |
|
91 | + break; |
|
92 | + default: |
|
93 | + parent::takeAttributeFromDOM($attribute); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 |
@@ -107,17 +107,17 @@ |
||
107 | 107 | protected function takeAttributeFromDOM($attribute) |
108 | 108 | { |
109 | 109 | switch ($attribute->localName) { |
110 | - case 'url': |
|
111 | - $this->_url = $attribute->nodeValue; |
|
112 | - break; |
|
113 | - case 'width': |
|
114 | - $this->_width = $attribute->nodeValue; |
|
115 | - break; |
|
116 | - case 'height': |
|
117 | - $this->_height = $attribute->nodeValue; |
|
118 | - break; |
|
119 | - default: |
|
120 | - parent::takeAttributeFromDOM($attribute); |
|
110 | + case 'url': |
|
111 | + $this->_url = $attribute->nodeValue; |
|
112 | + break; |
|
113 | + case 'width': |
|
114 | + $this->_width = $attribute->nodeValue; |
|
115 | + break; |
|
116 | + case 'height': |
|
117 | + $this->_height = $attribute->nodeValue; |
|
118 | + break; |
|
119 | + default: |
|
120 | + parent::takeAttributeFromDOM($attribute); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |