Skip to content

Commit 664188a

Browse files
2 parents b267366 + 36aada1 commit 664188a

5 files changed

Lines changed: 28 additions & 6 deletions

File tree

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ php:
88
- hhvm
99
matrix:
1010
include:
11+
- dist: trusty
12+
php: 7.0
13+
env: WORDPRESS_VERSION=46 INTEGRATION_TESTS=true
14+
script: bin/integration-tests
1115
- dist: trusty
1216
php: 7.0
1317
env: WORDPRESS_VERSION=45 INTEGRATION_TESTS=true

config/Dockerfile-wordpress-46

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM wordpress:4
2+
3+
ENV WORDPRESS_VERSION 4.6
4+
ENV WORDPRESS_UPSTREAM_VERSION 4.6
5+
ENV WORDPRESS_SHA1 830962689f350e43cd1a069f3a4f68a44c0339c8
6+
7+
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
8+
RUN curl -o wordpress.tar.gz -sSL https://wordpress.org/wordpress-${WORDPRESS_UPSTREAM_VERSION}.tar.gz \
9+
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
10+
&& tar -xzf wordpress.tar.gz -C /usr/src/ \
11+
&& rm wordpress.tar.gz \
12+
&& chown -R www-data:www-data /usr/src/wordpress
13+
14+
ENTRYPOINT ["/entrypoint.sh"]
15+
CMD ["apache2-foreground"]

src/class-tiny-compress-fopen.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ private function parse_headers( $headers ) {
193193
return $res;
194194
}
195195

196-
private function request_options( $method, $body = null ) {
196+
private function request_options( $method, $body = null, $content_type = 'image/png' ) {
197197
return array(
198198
'http' => array(
199199
'method' => $method,
200200
'header' => array(
201-
'Content-type: image/png',
201+
'Content-type: ' . $content_type,
202202
'Authorization: Basic ' . base64_encode( 'api:' . $this->api_key ),
203203
'User-Agent: ' . self::identifier(),
204204
),
@@ -226,8 +226,7 @@ private function output_request_options( $resize_opts, $preserve_opts ) {
226226
}
227227

228228
if ( $resize_opts || $preserve_opts ) {
229-
$options['http']['header'][] = 'Content-Type: application/json';
230-
return $this->request_options( 'GET', json_encode( $body ) );
229+
return $this->request_options( 'GET', json_encode( $body ), 'application/json' );
231230
} else {
232231
return $this->request_options( 'GET', null );
233232
}

src/views/account-status-loading.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
'Retrieving account status',
55
'tiny-compress-images'
66
); ?></p>
7+
8+
<input type="hidden" id="<?php echo esc_attr( self::get_prefixed_name( 'api_key' ) ); ?>"
9+
name="<?php echo esc_attr( self::get_prefixed_name( 'api_key' ) ); ?>" size="35" spellcheck="false"
10+
value="<?php echo esc_attr( $key ); ?>">
711
</div>
812
</div>

src/views/account-status-update.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
), $link );
1616
?></p>
1717

18-
<input type="text" id="tinypng_api_key"
19-
name="tinypng_api_key" size="35" spellcheck="false"
18+
<input type="text" id="<?php echo esc_attr( self::get_prefixed_name( 'api_key' ) ); ?>"
19+
name="<?php echo esc_attr( self::get_prefixed_name( 'api_key' ) ); ?>" size="35" spellcheck="false"
2020
value="<?php echo esc_attr( $key ); ?>">
2121

2222
<button class="button button-primary" data-tiny-action="update-key"><?php

0 commit comments

Comments
 (0)