@@ -67,7 +67,7 @@ public function render_provider_fields() {
67
67
]
68
68
),
69
69
esc_url ( 'https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey ' )
70
- )
70
+ ),
71
71
]
72
72
);
73
73
@@ -138,11 +138,11 @@ public function render_provider_fields() {
138
138
esc_url ( 'https://docs.aws.amazon.com/polly/latest/dg/long-form-voice-overview.html ' ),
139
139
esc_url ( 'https://docs.aws.amazon.com/polly/latest/dg/NTTS-main.html ' ),
140
140
esc_url ( 'https://aws.amazon.com/polly/pricing/ ' )
141
- )
141
+ ),
142
142
]
143
143
);
144
144
145
- $ voices_options = $ this ->get_voices_select_options ( $ settings ['voice_engine ' ] ?? '' );
145
+ $ voices_options = $ this ->get_voices_select_options ( $ settings ['voice_engine ' ] ?? '' );
146
146
if ( ! empty ( $ voices_options ) ) {
147
147
add_settings_field (
148
148
'voice ' ,
@@ -213,7 +213,7 @@ public function sanitize_settings( array $new_settings ): array {
213
213
$ new_settings [ static ::ID ]['access_key_id ' ] = $ new_access_key_id ;
214
214
$ new_settings [ static ::ID ]['secret_access_key ' ] = $ new_secret_access_key ;
215
215
$ new_settings [ static ::ID ]['aws_region ' ] = $ new_aws_region ;
216
- $ new_settings [ static ::ID ]['voices ' ] = $ this ->connect_to_service (
216
+ $ new_settings [ static ::ID ]['voices ' ] = $ this ->connect_to_service (
217
217
array (
218
218
'access_key_id ' => $ new_access_key_id ,
219
219
'secret_access_key ' => $ new_secret_access_key ,
@@ -271,7 +271,7 @@ public function connect_to_service( array $args = array() ): array {
271
271
try {
272
272
$ polly_client = $ this ->get_polly_client ( $ args );
273
273
$ polly_voices = $ polly_client ->describeVoices ();
274
- return $ polly_voices ->get ('Voices ' );
274
+ return $ polly_voices ->get ( 'Voices ' );
275
275
} catch ( \Exception $ e ) {
276
276
add_settings_error (
277
277
$ this ->feature_instance ->get_option_name (),
@@ -286,9 +286,10 @@ public function connect_to_service( array $args = array() ): array {
286
286
/**
287
287
* Returns HTML select dropdown options for voices.
288
288
*
289
+ * @param string $engine Engine type.
289
290
* @return array
290
291
*/
291
- public function get_voices_select_options ( string $ engine = "" ): array {
292
+ public function get_voices_select_options ( string $ engine = '' ): array {
292
293
$ settings = $ this ->feature_instance ->get_settings ( static ::ID );
293
294
$ voices = $ settings ['voices ' ];
294
295
$ options = array ();
@@ -364,7 +365,7 @@ public function synthesize_speech( int $post_id ) {
364
365
$ voice = $ settings [ static ::ID ]['voice ' ] ?? '' ;
365
366
366
367
try {
367
- $ polly_client = $ this ->get_polly_client ();
368
+ $ polly_client = $ this ->get_polly_client ();
368
369
369
370
/**
370
371
* Filter Synthesize speech args.
@@ -392,6 +393,7 @@ public function synthesize_speech( int $post_id ) {
392
393
$ this ,
393
394
$ this ->feature_instance
394
395
);
396
+
395
397
$ result = $ polly_client ->synthesizeSpeech ( $ synthesize_data );
396
398
397
399
update_post_meta ( $ post_id , self ::AUDIO_HASH_KEY , md5 ( $ post_content ) );
@@ -485,17 +487,17 @@ public function get_polly_client( array $aws_config = array() ) {
485
487
}
486
488
487
489
// Set the AWS SDK configuration.
488
- $ aws_sdk_config = [
489
- 'region ' => $ default ['aws_region ' ] ?? 'us-east-1 ' ,
490
- 'version ' => 'latest ' ,
491
- 'ua_append ' => ['request-source/classifai ' ],
490
+ $ aws_sdk_config = [
491
+ 'region ' => $ default ['aws_region ' ] ?? 'us-east-1 ' ,
492
+ 'version ' => 'latest ' ,
493
+ 'ua_append ' => [ 'request-source/classifai ' ],
492
494
'credentials ' => [
493
495
'key ' => $ default ['access_key_id ' ],
494
496
'secret ' => $ default ['secret_access_key ' ],
495
497
],
496
498
];
497
499
498
- $ sdk = new \Aws \Sdk ($ aws_sdk_config );
500
+ $ sdk = new \Aws \Sdk ( $ aws_sdk_config );
499
501
return $ sdk ->createPolly ();
500
502
}
501
503
0 commit comments