Skip to content

Commit 46188bd

Browse files
committed
Merge branch 'develop'
2 parents 856bd9c + 589efed commit 46188bd

23 files changed

+170
-81
lines changed

CHANGES.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#### [unreleased]
22

3+
#### 8.7.3 / 2019-04-08
4+
* fixed PHP notices on Install [#775](https://github.com/afragen/github-updater/issues/775)
5+
* updated location of `tmp-readme.txt` file to use `get_temp_dir()`, thanks @DavidAnderson684
6+
* a11y updates for `label for=...`
7+
* fixed to only set cron event for main site only when `DISABLE_WP_CRON` is set, fixes [#782](https://github.com/afragen/github-updater/issues/782)
8+
* a11y updates for settings tabs
9+
* remove filter for `http_request_args` after use, fixes [#783](https://github.com/afragen/github-updater/issues/783)
10+
311
#### 8.7.2 / 2019-03-09
412
* hotfix to add parity for themes and prevent PHP warning
513

composer.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github-updater.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Plugin Name: GitHub Updater
1313
* Plugin URI: https://github.com/afragen/github-updater
1414
* Description: A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress.
15-
* Version: 8.7.2
15+
* Version: 8.7.3
1616
* Author: Andy Fragen
1717
* License: GNU General Public License v2
1818
* License URI: http://www.gnu.org/licenses/gpl-2.0.html

languages/github-updater.pot

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# This file is distributed under the same license as the GitHub Updater plugin.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: GitHub Updater 8.7.2\n"
5+
"Project-Id-Version: GitHub Updater 8.7.3\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/github-updater\n"
77
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
88
"Language-Team: LANGUAGE <[email protected]>\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=UTF-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
12-
"POT-Creation-Date: 2019-03-09T22:01:08+00:00\n"
12+
"POT-Creation-Date: 2019-04-09T04:15:06+00:00\n"
1313
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1414
"X-Generator: WP-CLI 2.1.0\n"
1515
"X-Domain: github-updater\n"
@@ -157,65 +157,65 @@ msgstr ""
157157
msgid "Installed Plugins and Themes"
158158
msgstr ""
159159

160-
#: src/GitHub_Updater/Plugin.php:322
160+
#: src/GitHub_Updater/Plugin.php:326
161161
msgid "View details"
162162
msgstr ""
163163

164164
#. translators: %s: theme name
165-
#: src/GitHub_Updater/Theme.php:336
166-
#: src/GitHub_Updater/Theme.php:532
165+
#: src/GitHub_Updater/Theme.php:340
166+
#: src/GitHub_Updater/Theme.php:536
167167
msgid "There is a new version of %s available."
168168
msgstr ""
169169

170170
#. translators: %s: theme version
171-
#: src/GitHub_Updater/Theme.php:348
171+
#: src/GitHub_Updater/Theme.php:352
172172
msgid "View version %s details."
173173
msgstr ""
174174

175-
#: src/GitHub_Updater/Theme.php:352
175+
#: src/GitHub_Updater/Theme.php:356
176176
msgid "Automatic update is unavailable for this theme."
177177
msgstr ""
178178

179179
#. translators: 1: version number, 2: closing anchor tag, 3: update URL
180-
#: src/GitHub_Updater/Theme.php:357
181-
#: src/GitHub_Updater/Theme.php:542
180+
#: src/GitHub_Updater/Theme.php:361
181+
#: src/GitHub_Updater/Theme.php:546
182182
msgid "View version %1$s details%2$s or %3$supdate now%2$s."
183183
msgstr ""
184184

185185
#. translators: %s: theme name
186-
#: src/GitHub_Updater/Theme.php:362
187-
#: src/GitHub_Updater/Theme.php:547
186+
#: src/GitHub_Updater/Theme.php:366
187+
#: src/GitHub_Updater/Theme.php:551
188188
msgid "Update %s now"
189189
msgstr ""
190190

191191
#. translators: 1: branch name, 2: jQuery dropdown, 3: closing tag
192-
#: src/GitHub_Updater/Theme.php:584
193-
#: src/GitHub_Updater/Base.php:913
192+
#: src/GitHub_Updater/Theme.php:588
193+
#: src/GitHub_Updater/Base.php:912
194194
msgid "Current branch is `%1$s`, try %2$sanother version%3$s"
195195
msgstr ""
196196

197-
#: src/GitHub_Updater/Theme.php:592
197+
#: src/GitHub_Updater/Theme.php:596
198198
msgid "Choose a Version"
199199
msgstr ""
200200

201-
#: src/GitHub_Updater/Theme.php:610
202-
#: src/GitHub_Updater/Base.php:948
201+
#: src/GitHub_Updater/Theme.php:614
202+
#: src/GitHub_Updater/Base.php:947
203203
msgid "No previous tags to rollback to."
204204
msgstr ""
205205

206-
#: src/GitHub_Updater/Theme.php:614
206+
#: src/GitHub_Updater/Theme.php:618
207207
msgid "Install"
208208
msgstr ""
209209

210-
#: src/GitHub_Updater/Base.php:448
210+
#: src/GitHub_Updater/Base.php:447
211211
msgid "There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is overdue."
212212
msgstr ""
213213

214-
#: src/GitHub_Updater/Base.php:924
214+
#: src/GitHub_Updater/Base.php:923
215215
msgid "Switch to branch "
216216
msgstr ""
217217

218-
#: src/GitHub_Updater/Base.php:940
218+
#: src/GitHub_Updater/Base.php:939
219219
msgid "Switch to release "
220220
msgstr ""
221221

src/GitHub_Updater/API.php

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ protected function api( $url ) {
230230
$response = wp_remote_get( $this->get_api_url( $url ) );
231231
$code = (int) wp_remote_retrieve_response_code( $response );
232232
$allowed_codes = [ 200, 404 ];
233+
remove_filter( 'http_request_args', [ $this, 'http_request_args' ] );
233234

234235
if ( is_wp_error( $response ) ) {
235236
Singleton::get_instance( 'Messages', $this )->create_error_message( $response );

src/GitHub_Updater/API/Bitbucket_API.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public function add_install_settings_fields( $type ) {
508508
public function is_private_repo() {
509509
?>
510510
<label for="is_private">
511-
<input class="bitbucket_setting" type="checkbox" name="is_private" <?php checked( '1', false ); ?> >
511+
<input class="bitbucket_setting" type="checkbox" id="is_private" name="is_private" <?php checked( '1', false ); ?> >
512512
<br>
513513
<span class="description">
514514
<?php esc_html_e( 'Check for private Bitbucket repositories.', 'github-updater' ); ?>
@@ -523,7 +523,7 @@ public function is_private_repo() {
523523
public function bitbucket_username() {
524524
?>
525525
<label for="bitbucket_username">
526-
<input class="bitbucket_setting" type="text" style="width:50%;" name="bitbucket_username" value="">
526+
<input class="bitbucket_setting" type="text" style="width:50%;" id="bitbucket_username" name="bitbucket_username" value="">
527527
<br>
528528
<span class="description">
529529
<?php esc_html_e( 'Enter Bitbucket username.', 'github-updater' ); ?>
@@ -538,7 +538,7 @@ public function bitbucket_username() {
538538
public function bitbucket_password() {
539539
?>
540540
<label for="bitbucket_password">
541-
<input class="bitbucket_setting" type="password" style="width:50%;" name="bitbucket_password" value="" autocomplete="new-password">
541+
<input class="bitbucket_setting" type="password" style="width:50%;" id="bitbucket_password" name="bitbucket_password" value="" autocomplete="new-password">
542542
<br>
543543
<span class="description">
544544
<?php esc_html_e( 'Enter Bitbucket password.', 'github-updater' ); ?>

src/GitHub_Updater/API/GitHub_API.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function ( $subtabs ) {
475475
public function github_access_token() {
476476
?>
477477
<label for="github_access_token">
478-
<input class="github_setting" type="password" style="width:50%;" name="github_access_token" value="" autocomplete="new-password">
478+
<input class="github_setting" type="password" style="width:50%;" id="github_access_token" name="github_access_token" value="" autocomplete="new-password">
479479
<br>
480480
<span class="description">
481481
<?php esc_html_e( 'Enter GitHub Access Token for private GitHub repositories.', 'github-updater' ); ?>
@@ -493,7 +493,9 @@ public function github_access_token() {
493493
* @return mixed
494494
*/
495495
public function remote_install( $headers, $install ) {
496-
$github_com = true;
496+
$github_com = true;
497+
$options['github_access_token'] = isset( static::$options['github_access_token'] ) ? static::$options['github_access_token'] : null;
498+
$options['github_enterprise_token'] = isset( static::$options['github_enterprise_token'] ) ? static::$options['github_enterprise_token'] : null;
497499

498500
if ( 'github.com' === $headers['host'] || empty( $headers['host'] ) ) {
499501
$base = 'https://api.github.com';
@@ -524,11 +526,11 @@ public function remote_install( $headers, $install ) {
524526
if ( $github_com ) {
525527
$token = ! empty( $install['options']['github_access_token'] )
526528
? $install['options']['github_access_token']
527-
: static::$options['github_access_token'];
529+
: $options['github_access_token'];
528530
} else {
529531
$token = ! empty( $install['options']['github_enterprise_token'] )
530532
? $install['options']['github_enterprise_token']
531-
: static::$options['github_enterprise_token'];
533+
: $options['github_enterprise_token'];
532534
}
533535

534536
if ( ! empty( $token ) ) {

src/GitHub_Updater/API/GitLab_API.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public function add_install_settings_fields( $type ) {
540540
public function gitlab_access_token() {
541541
?>
542542
<label for="gitlab_access_token">
543-
<input class="gitlab_setting" type="password" style="width:50%;" name="gitlab_access_token" value="" autocomplete="new-password">
543+
<input class="gitlab_setting" type="password" style="width:50%;" id="gitlab_access_token" name="gitlab_access_token" value="" autocomplete="new-password">
544544
<br>
545545
<span class="description">
546546
<?php esc_html_e( 'Enter GitLab Access Token for private GitLab repositories.', 'github-updater' ); ?>
@@ -592,7 +592,9 @@ public function gitlab_error() {
592592
* @return mixed $install
593593
*/
594594
public function remote_install( $headers, $install ) {
595-
$gitlab_com = true;
595+
$gitlab_com = true;
596+
$options['gitlab_access_token'] = isset( static::$options['gitlab_access_token'] ) ? static::$options['gitlab_access_token'] : null;
597+
$options['gitlab_enterprise_token'] = isset( static::$options['gitlab_enterprise_token'] ) ? static::$options['gitlab_enterprise_token'] : null;
596598

597599
if ( 'gitlab.com' === $headers['host'] || empty( $headers['host'] ) ) {
598600
$base = 'https://gitlab.com';
@@ -620,11 +622,11 @@ public function remote_install( $headers, $install ) {
620622
if ( $gitlab_com ) {
621623
$token = ! empty( $install['options']['gitlab_access_token'] )
622624
? $install['options']['gitlab_access_token']
623-
: static::$options['gitlab_access_token'];
625+
: $options['gitlab_access_token'];
624626
} else {
625627
$token = ! empty( $install['options']['gitlab_enterprise_token'] )
626628
? $install['options']['gitlab_enterprise_token']
627-
: static::$options['gitlab_enterprise_token'];
629+
: $options['gitlab_enterprise_token'];
628630
}
629631

630632
if ( ! empty( $token ) ) {

src/GitHub_Updater/API/Gitea_API.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public function add_install_settings_fields( $type ) {
433433
public function gitea_access_token() {
434434
?>
435435
<label for="gitea_access_token">
436-
<input class="gitea_setting" type="password" style="width:50%;" name="gitea_access_token" value="" autocomplete="new-password">
436+
<input class="gitea_setting" type="password" style="width:50%;" id="gitea_access_token" name="gitea_access_token" value="" autocomplete="new-password">
437437
<br>
438438
<span class="description">
439439
<?php esc_html_e( 'Enter Gitea Access Token for private Gitea repositories.', 'github-updater' ); ?>
@@ -483,6 +483,8 @@ public function gitea_error() {
483483
* @return mixed $install
484484
*/
485485
public function remote_install( $headers, $install ) {
486+
$options['gitea_access_token'] = isset( static::$options['gitea_access_token'] ) ? static::$options['gitea_access_token'] : null;
487+
486488
$base = $headers['base_uri'] . '/api/v1';
487489

488490
$install['download_link'] = "{$base}/repos/{$install['github_updater_repo']}/archive/{$install['github_updater_branch']}.zip";
@@ -497,7 +499,7 @@ public function remote_install( $headers, $install ) {
497499

498500
$token = ! empty( $install['options']['gitea_access_token'] )
499501
? $install['options']['gitea_access_token']
500-
: static::$options['gitea_access_token'];
502+
: $options['gitea_access_token'];
501503

502504
if ( ! empty( $token ) ) {
503505
$install['download_link'] = add_query_arg( 'access_token', $token, $install['download_link'] );

src/GitHub_Updater/API/Zipfile_API.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function add_install_settings_fields( $type ) {
4747
public function zipfile_slug() {
4848
?>
4949
<label for="zipfile_slug">
50-
<input class="zipfile_setting" type="text" style="width:50%;" name="zipfile_slug" value="" placeholder="my-repo-slug">
50+
<input class="zipfile_setting" type="text" style="width:50%;" id="zipfile_slug" name="zipfile_slug" value="" placeholder="my-repo-slug">
5151
<br>
5252
<span class="description">
5353
<?php esc_html_e( 'Enter plugin or theme slug.', 'github-updater' ); ?>

src/GitHub_Updater/Base.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ protected function get_changelog_filename( $repo ) {
408408
public function remove_hooks( $repo_api ) {
409409
remove_filter( 'extra_theme_headers', [ $this, 'add_headers' ] );
410410
remove_filter( 'extra_plugin_headers', [ $this, 'add_headers' ] );
411-
remove_filter( 'http_request_args', [ 'Fragen\\GitHub_Updater\\API', 'http_request_args' ] );
412411
remove_filter( 'http_response', [ 'Fragen\\GitHub_Updater\\API', 'wp_update_response' ] );
413412

414413
if ( $repo_api instanceof Bitbucket_API ) {
@@ -865,7 +864,7 @@ protected function get_repo_parts( $repo, $type ) {
865864
*/
866865
protected function update_row_enclosure( $repo_name, $type, $branch_switcher = false ) {
867866
global $wp_version;
868-
$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
867+
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
869868
$repo_base = $repo_name;
870869
$shiny_classes = ' notice inline notice-warning notice-alt';
871870

src/GitHub_Updater/Install.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public function register_settings( $type ) {
455455
public function get_repo() {
456456
?>
457457
<label for="github_updater_repo">
458-
<input type="text" style="width:50%;" name="github_updater_repo" value="" autofocus>
458+
<input type="text" style="width:50%;" id="github_updater_repo" name="github_updater_repo" value="" autofocus>
459459
<br>
460460
<span class="description">
461461
<?php esc_html_e( 'URI is case sensitive.', 'github-updater' ); ?>
@@ -470,7 +470,7 @@ public function get_repo() {
470470
public function branch() {
471471
?>
472472
<label for="github_updater_branch">
473-
<input type="text" style="width:50%;" name="github_updater_branch" value="" placeholder="master">
473+
<input type="text" style="width:50%;" id="github_updater_branch" name="github_updater_branch" value="" placeholder="master">
474474
<br>
475475
<span class="description">
476476
<?php esc_html_e( 'Enter branch name or leave empty for `master`', 'github-updater' ); ?>
@@ -485,7 +485,7 @@ public function branch() {
485485
public function install_api() {
486486
?>
487487
<label for="github_updater_api">
488-
<select name="github_updater_api">
488+
<select id="github_updater_api" name="github_updater_api">
489489
<?php foreach ( self::$git_servers as $key => $value ) : ?>
490490
<?php if ( self::$installed_apis[ $key . '_api' ] ) : ?>
491491
<option value="<?php esc_attr_e( $key ); ?>" <?php selected( $key ); ?> >

src/GitHub_Updater/Plugin.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,15 @@ public function get_remote_plugin_meta() {
204204
}
205205
}
206206

207-
if ( ! wp_next_scheduled( 'ghu_get_remote_plugin' ) &&
207+
$schedule_event = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ? is_main_site() : true;
208+
209+
if ( $schedule_event ) {
210+
if ( ! wp_next_scheduled( 'ghu_get_remote_plugin' ) &&
208211
! $this->is_duplicate_wp_cron_event( 'ghu_get_remote_plugin' ) &&
209212
! apply_filters( 'github_updater_disable_wpcron', false )
210-
) {
211-
wp_schedule_single_event( time(), 'ghu_get_remote_plugin', [ $plugins ] );
213+
) {
214+
wp_schedule_single_event( time(), 'ghu_get_remote_plugin', [ $plugins ] );
215+
}
212216
}
213217

214218
// Update plugin transient with rollback (branch switching) data.

src/GitHub_Updater/Readme_Parser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Readme_Parser extends Parser {
4545
* @return void
4646
*/
4747
public function __construct( $file ) {
48-
$file_path = WP_CONTENT_DIR . '/tmp-readme.txt';
48+
$file_path = trailingslashit( get_temp_dir() ) . md5( $file ) . '-tmp-readme.txt';
4949

5050
/**
5151
* Filter location of temporary readme filepath.

src/GitHub_Updater/Remote_Management.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function token_callback_checkbox_remote( $args ) {
257257
$checked = isset( self::$options_remote[ $args['id'] ] ) ? self::$options_remote[ $args['id'] ] : null;
258258
?>
259259
<label for="<?php esc_attr_e( $args['id'] ); ?>">
260-
<input type="checkbox" name="github_updater_remote_management[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', $checked ); ?> >
260+
<input type="checkbox" id="<?php esc_attr_e( $args['id'] ); ?>" name="github_updater_remote_management[<?php esc_attr_e( $args['id'] ); ?>]" value="1" <?php checked( '1', $checked ); ?> >
261261
<?php echo $args['title']; ?>
262262
</label>
263263
<?php

0 commit comments

Comments
 (0)