Permalink
Browse files

spacing and doc fixes

  • Loading branch information...
afragen committed Mar 4, 2014
1 parent fb9b370 commit de9cf08d2cc5662f56ba4587596649d830b9af5d
View
@@ -87,7 +87,7 @@ GitHub Branch: master
*/
~~~
-Optional headers `GitHub Access Token`, `GitHub Branch` and `Bitbucket Branch` are available but not required.
+Optional headers `GitHub Access Token`, `GitHub Branch`, `GitHub Timeout`, `Bitbucket Branch`, and `Bitbucket Timeout` are available but not required.
## Tagging
@@ -24,8 +24,8 @@ class GitHub_Updater_BitBucket_API extends GitHub_Updater {
* @param string $type
*/
public function __construct( $type ) {
- $this->type = $type;
- self::$hours = 4;
+ $this->type = $type;
+ self::$hours = 4;
if ( ! empty( $this->type->timeout ) ) {
self::$hours = (float) $this->type->timeout;
@@ -65,7 +65,7 @@ protected function api( $url ) {
* @return string
*/
protected function get_api_url( $endpoint ) {
- $segments = array(
+ $segments = array(
'owner' => $this->type->owner,
'repo' => $this->type->repo,
);
@@ -160,7 +160,8 @@ protected function get_default_branch( $response ) {
* @return string latest tag.
*/
public function get_remote_tag() {
- $response = get_site_transient( 'ghu-' . md5( $this->type->repo . 'tags' ) );
+ $download_link_base = 'https://bitbucket.org/' . trailingslashit( $this->type->owner ) . $this->type->repo . '/get/';
+ $response = get_site_transient( 'ghu-' . md5( $this->type->repo . 'tags' ) );
if ( ! $response ) {
$response = $this->api( '1.0/repositories/:owner/:repo/tags' );
@@ -184,8 +185,8 @@ public function get_remote_tag() {
if ( false !== $response ) {
foreach ( (array) $response as $num => $tag ) {
if ( isset( $num ) ) {
- $tags[] = $num;
- $rollback[ $num ] = 'https://bitbucket.org/' . trailingslashit( $this->type->owner ) . $this->type->repo . '/get/' . $num . '.zip';
+ $tags[] = $num;
+ $rollback[ $num ] = $download_link_base . $num . '.zip';
}
}
}
@@ -24,13 +24,12 @@ class GitHub_Updater_GitHub_API extends GitHub_Updater {
* @param string $type
*/
public function __construct( $type ) {
- $this->type = $type;
+ $this->type = $type;
self::$hours = 4;
if ( ! empty( $this->type->timeout ) ) {
self::$hours = (float) $this->type->timeout;
}
-
}
/**
@@ -187,7 +186,7 @@ public function get_remote_tag() {
if ( false !== $response ) {
foreach ( (array) $response as $num => $tag ) {
if ( isset( $tag->name ) ) {
- $tags[] = $tag->name;
+ $tags[] = $tag->name;
$rollback[ $tag->name ] = $tag->zipball_url;
}
}
@@ -287,7 +286,7 @@ public function get_remote_changes( $changes ) {
* @return base64 decoded repository meta data
*/
public function get_repo_meta() {
- $response = get_site_transient( 'ghu-' . md5( $this->type->repo . 'meta' ) );
+ $response = get_site_transient( 'ghu-' . md5( $this->type->repo . 'meta' ) );
$meta_query = '?q=' . $this->type->repo . '+user:' . $this->type->owner;
if ( ! $response ) {
@@ -325,7 +325,7 @@ protected function set_defaults( $type ) {
$this->$type->download_link = '';
$this->$type->tags = array();
$this->$type->rollback = array();
- $this->$type->sections['changelog'] = 'No changelog is available via GitHub Updater. Create a file <code>CHANGES.md</code> in your repository. Please consider helping out with a pull request to fix <a href="https://github.com/afragen/github-updater/issues/8">issue #8</a>.';
+ $this->$type->sections['changelog'] = 'No changelog is available via GitHub Updater. Create a file <code>CHANGES.md</code> in your repository.';
$this->$type->requires = null;
$this->$type->tested = null;
$this->$type->downloaded = 0;
@@ -409,16 +409,18 @@ public function no_ssl_http_request_args( $args ) {
}
/**
- * Add Basis Authentication $args to http_request_args filter hook
+ * Add Basic Authentication $args to http_request_args filter hook
*
* @param array $args Existing HTTP Request arguments
*
* @return mixed Amended HTTP Request arguments
*/
public function maybe_authenticate_http( $args ) {
+ $username = null;
+ $password = null;
if ( ! empty( $this->type->access_token ) ) { return $args; }
-
if ( ! isset( $this->type->user ) || ! isset( $this->type->pass ) ) { return $args; }
+
if ( $this->type->user && $this->type->pass ) {
$username = $this->type->user;
$password = $this->type->pass;
@@ -67,9 +67,7 @@ public function __construct() {
* @since 2.0.0
*/
public function plugins_api( $false, $action, $response ) {
- if ( ! ( 'plugin_information' === $action ) ) {
- return $false;
- }
+ if ( ! ( 'plugin_information' === $action ) ) { return $false; }
$wp_repo_data = get_site_transient( 'ghu-' . md5( $response->slug . 'php' ) );
if ( ! $wp_repo_data ) {
@@ -214,7 +214,6 @@ public static function remove_after_theme_row( $theme_key, $theme ) {
*/
public function customize_theme_update_html($prepared_themes) {
foreach ( (array) $this->config as $theme ) {
-
if ( empty( $prepared_themes[ $theme->repo ] ) ) { continue; }
if ( ! empty( $prepared_themes[ $theme->repo ]['hasUpdate'] ) ) {
@@ -267,7 +266,7 @@ private function append_theme_actions_content( $theme ){
">
<option value="">Choose a Version...</option>
<option><?php echo $theme->branch; ?></option>
- <?php foreach ( $theme_update_transient->up_to_date[$theme->repo]['rollback'] as $version => $url ){echo'<option>'.$version.'</option>';}?></select>
+ <?php foreach ( $theme_update_transient->up_to_date[$theme->repo]['rollback'] as $version => $url ){ echo'<option>'.$version.'</option>'; }?></select>
<a style="display: none;" class="button-primary" href="?">Install</a>
</div>
<?php

0 comments on commit de9cf08

Please sign in to comment.