public function ghu_tokens() {
		$ghu_options_keys = [];
		$ghu_plugins      = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
		$ghu_themes       = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
		$ghu_tokens       = array_merge( $ghu_plugins, $ghu_themes );

		foreach ( $ghu_tokens as $token ) {
			$type                             = '<span class="dashicons dashicons-admin-plugins"></span>&nbsp;';
			$setting_field                    = [];
			$ghu_options_keys[ $token->slug ] = null;

			/*
			 * Check to see if it's a private repo or Enterprise and set variables.
			 */
			$this->set_auth_required( $token );

			/*
			 * Next if not a private repo or token field not empty.
			 */
			if ( ! $this->is_private( $token ) ) {
				continue;
			}

			if ( 'theme' === $token->type ) {
				$type = '<span class="dashicons dashicons-admin-appearance"></span>&nbsp;';
			}

			$setting_field['id']    = $token->slug;
			$setting_field['title'] = $type . esc_html( $token->name );

			$repo_setting_field = apply_filters( 'github_updater_add_repo_setting_field', [], $token, $token->git );

			if ( empty( $repo_setting_field ) ) {
				continue;
			}

			$setting_field             = array_merge( $setting_field, $repo_setting_field );
			$setting_field['callback'] = $token->slug;

			$title = 'token_callback_checkbox' !== $setting_field['callback_method'][1] ? $setting_field['title'] : null;
			add_settings_field(
				$setting_field['id'],
				$title,
				$setting_field['callback_method'],
				$setting_field['page'],
				$setting_field['section'],
				[
					'id'    => $setting_field['callback'],
					'token' => true,
					'title' => $setting_field['title'],
				]
			);
		}

		if ( ! $this->waiting_for_background_update() ) {
			$this->unset_stale_options( $ghu_options_keys, $ghu_tokens );
		} else {
			Singleton::get_instance( 'Messages', $this )->create_error_message( 'waiting' );
		}
	}
public function ghu_tokens() {
		$ghu_options_keys = [];
		$ghu_plugins      = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
		$ghu_themes       = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
		$ghu_tokens       = array_merge( $ghu_plugins, $ghu_themes );

		foreach ( $ghu_tokens as $token ) {
			$type                             = '<span class="dashicons dashicons-admin-plugins"></span>&nbsp;';
			$setting_field                    = [];
			$ghu_options_keys[ $token->slug ] = null;

			/*
			 * Check to see if it's a private repo or Enterprise and set variables.
			 */
			$this->set_auth_required( $token );

			/*
			 * Next if not a private repo or token field not empty.
			 */
			if ( ! $this->is_private( $token ) ) {
				continue;
			}

			if ( 'theme' === $token->type ) {
				$type = '<span class="dashicons dashicons-admin-appearance"></span>&nbsp;';
			}

			$setting_field['id']    = $token->slug;
			$setting_field['title'] = $type . esc_html( $token->name );

			$repo_setting_field = apply_filters( 'github_updater_add_repo_setting_field', [], $token, $token->git );

			if ( empty( $repo_setting_field ) ) {
				continue;
			}

			$setting_field             = array_merge( $setting_field, $repo_setting_field );
			$setting_field['callback'] = $token->slug;

			$title = 'token_callback_checkbox' !== $setting_field['callback_method'][1] ? $setting_field['title'] : null;
			add_settings_field(
				$setting_field['id'],
				$title,
				$setting_field['callback_method'],
				$setting_field['page'],
				$setting_field['section'],
				[
					'id'    => $setting_field['callback'],
					'token' => true,
					'title' => $setting_field['title'],
				]
			);
		}

		if ( ! $this->waiting_for_background_update() ) {
			$this->unset_stale_options( $ghu_options_keys, $ghu_tokens );
		} else {
			Singleton::get_instance( 'Messages', $this )->create_error_message( 'waiting' );
		}
	}
public function ghu_tokens ( ) { $ ghu_options_keys = [ ] ; $ ghu_plugins = Singleton :: get_instance ( 'Plugin' , $ this ) -> get_plugin_configs ( ) ; $ ghu_themes = Singleton :: get_instance ( 'Theme' , $ this ) -> get_theme_configs ( ) ; $ ghu_tokens = array_merge ( $ ghu_plugins , $ ghu_themes ) ; foreach ( $ ghu_tokens as $ token ) { $ type = '<span class="dashicons dashicons-admin-plugins"></span>&nbsp;' ; $ setting_field = [ ] ; $ ghu_options_keys [ $ token -> slug ] = null ; /*
			 * Check to see if it's a private repo or Enterprise and set variables.
			 */ $ this -> set_auth_required ( $ token ) ; /*
			 * Next if not a private repo or token field not empty.
			 */ if ( ! $ this -> is_private ( $ token ) ) { continue ; } if ( 'theme' === $ token -> type ) { $ type = '<span class="dashicons dashicons-admin-appearance"></span>&nbsp;' ; } $ setting_field [ 'id' ] = $ token -> slug ; $ setting_field [ 'title' ] = $ type . esc_html ( $ token -> name ) ; $ repo_setting_field = apply_filters ( 'github_updater_add_repo_setting_field' , [ ] , $ token , $ token -> git ) ; if ( empty ( $ repo_setting_field ) ) { continue ; } $ setting_field = array_merge ( $ setting_field , $ repo_setting_field ) ; $ setting_field [ 'callback' ] = $ token -> slug ; $ title = 'token_callback_checkbox' !== $ setting_field [ 'callback_method' ] [ 1 ] ? $ setting_field [ 'title' ] : null ; add_settings_field ( $ setting_field [ 'id' ] , $ title , $ setting_field [ 'callback_method' ] , $ setting_field [ 'page' ] , $ setting_field [ 'section' ] , [ 'id' => $ setting_field [ 'callback' ] , 'token' => true , 'title' => $ setting_field [ 'title' ] , ] ) ; } if ( ! $ this -> waiting_for_background_update ( ) ) { $ this -> unset_stale_options ( $ ghu_options_keys , $ ghu_tokens ) ; } else { Singleton :: get_instance ( 'Messages' , $ this ) -> create_error_message ( 'waiting' ) ; } }
Create and return settings fields for private repositories.
Create and return settings fields for private repositories .