Skip to content

Commit d0ab50c

Browse files
Merge pull request #173 from rtMediaWP/feature/vip-blockers
#172 Address VIP blocker issues.
2 parents b4e4c13 + e6fca14 commit d0ab50c

12 files changed

+215
-220
lines changed

Gruntfile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ module.exports = function( grunt ) {
1414
tasks: [ 'autoprefixer', 'cssmin' ]
1515
},
1616
js: {
17-
files: [ '<%= uglify.backend.src %>' ],
17+
files: [
18+
'<%= uglify.backend.src %>',
19+
'<%= uglify.footer.src %>',
20+
],
1821
tasks: [ 'uglify' ]
1922
}
2023
},

admin/js/build/rt-transcoder-block-editor-support.build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/js/rt-transcoder-admin.js

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,24 @@
1414
'click',
1515
'#api-key-submit',
1616
function( e ) {
17-
e.preventDefault();
18-
19-
if ( $( this ).next( 'img' ).length === 0 ) {
20-
$( this ).after( $( '<img/>' ).attr( 'src', rt_transcoder_script.loader_image ).addClass( 'rtt-loader' ) );
21-
}
22-
23-
var data = {
24-
action: 'rt_enter_api_key',
25-
apikey: $( '#new-api-key' ).val()
26-
};
27-
28-
// Since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php.
29-
$.getJSON(
30-
ajaxurl,
31-
data,
32-
function( response ) {
17+
var apikey = document.getElementById( 'new-api-key' ).value;
3318

34-
var tempUrl = window.location.href;
35-
var hash = window.location.hash;
19+
if ( ! apikey ) {
3620

37-
if ( response.error === undefined && response.apikey ) {
21+
$( '#api-key-error' ).remove();
3822

39-
tempUrl = tempUrl.replace( hash, '' );
40-
41-
if ( -1 === tempUrl.toString().indexOf( '&apikey=' + response.apikey ) ) {
42-
tempUrl += '&apikey=' + response.apikey;
43-
}
44-
45-
if ( -1 === tempUrl.toString().indexOf( '&update=true' ) ) {
46-
tempUrl += '&update=true';
47-
}
48-
49-
document.location.href = tempUrl + hash;
50-
} else {
51-
$( '#api-key-error' ).remove();
52-
53-
var error_div = $(
54-
'<div/>',
55-
{
56-
id: 'api-key-error',
57-
class: 'error'
58-
}
59-
);
60-
61-
$( 'h1:first' ).after( error_div.html( $( '<p/>' ).text( response.error ) ) ); // phpcs:ignoe WordPressVIPMinimum.JS.HTMLExecutingFunctions.html
23+
var error_div = $(
24+
'<div/>',
25+
{
26+
id: 'api-key-error',
27+
class: 'error'
6228
}
29+
);
6330

64-
$( '#api-key-submit' ).next( 'img' ).remove();
65-
}
66-
);
31+
$( 'h1:first' ).after( error_div.html( $( '<p/>' ).text( rt_transcoder_script.error_empty_key ) ) );
32+
33+
e.preventDefault();
34+
}
6735
}
6836
);
6937

admin/js/rt-transcoder-admin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/js/rt-transcoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
check_status_element.hide();
3737
}
3838

39-
span_status_element.html( obj.message );
39+
span_status_element.text( obj.message );
4040
span_status_element.show();
41-
check_status_element.html( btn_text );
41+
check_status_element.text( btn_text );
4242
check_status_element.prop( 'disabled', false );
4343
} );
4444
} );

admin/js/rt-transcoder.min.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* @package Transcoder
44
*/
55

6-
!function(a){a(document).ready(function(){transcoding_status.load_flag&&a('[name="check_status_btn"]').live("click",function(b){var c=a(this).data("value"),d=a("#btn_check_status"+c).text();a("#span_status"+c).html(""),a("#btn_check_status"+c).html("Checking..."),a("#span_status"+c).hide(),a("#btn_check_status"+c).prop("disabled",!0);var e={action:"checkstatus",postid:c,security:transcoding_status.security_nonce};jQuery.post(ajaxurl,e,function(b){var e=jQuery.parseJSON(b.replace(/&quot;/g,'"'));"Success"===e.status&&a("#btn_check_status"+c).hide(),a("#span_status"+c).html(e.message),a("#span_status"+c).show(),a("#btn_check_status"+c).html(d),a("#btn_check_status"+c).prop("disabled",!1)})})})}(jQuery);
6+
!function(a){a(document).ready(function(){transcoding_status.load_flag&&a('[name="check_status_btn"]').live("click",function(b){var c=a(this).data("value"),d=a("#btn_check_status"+c).text(),e=a("#span_status"+c),f=a("#btn_check_status"+c);e.text(""),f.text("Checking..."),e.hide(),f.prop("disabled",!0);var g={action:"checkstatus",postid:c,security:transcoding_status.security_nonce};jQuery.post(ajaxurl,g,function(a){var b=jQuery.parseJSON(a.replace(/&quot;/g,'"'));"Success"===b.status&&f.hide(),e.text(b.message),e.show(),f.text(d),f.prop("disabled",!1)})})})}(jQuery);

admin/partials/rt-transcoder-admin-display.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @subpackage Transcoder/Admin/Partials
99
*/
1010

11+
$current_page = transcoder_filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
1112
?>
1213
<div class="wrap">
1314
<h1 class="rtm-option-title">
@@ -23,18 +24,21 @@
2324
</h1>
2425
<div id="rtt-settings_updated" class="updated settings-error notice is-dismissible hide">
2526
<p></p>
26-
<button type="button" class="notice-dismiss"><span
27-
class="screen-reader-text"><?php echo esc_attr__( 'Dismiss this notice', 'transcoder' ); ?>.</span>
27+
<button type="button" class="notice-dismiss">
28+
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice', 'transcoder' ); ?>.</span>
2829
</button>
2930
</div>
3031
<div class="transcoder-settings-boxes-wrapper">
3132
<div id="transcoder-settings-boxes" class="transcoder-settings-boxes-container transcoder-setting-container">
3233
<p>
34+
<form method="get" action="/wp-admin/admin.php">
3335
<label for="new-api-key">
3436
<?php esc_html_e( 'Enter License Key', 'transcoder' ); ?>
3537
</label>
36-
<input id="new-api-key" type="text" name="new-api-key" value="<?php echo esc_attr( $this->stored_api_key ); ?>" size="60"/>
37-
<input type="submit" id="api-key-submit" name="api-key-submit" value="<?php echo esc_attr__( 'Save Key', 'transcoder' ); ?>" class="button-primary"/>
38+
<input type="hidden" name="page" value="<?php echo esc_attr( $current_page ); ?>">
39+
<input id="new-api-key" type="text" name="apikey" value="<?php echo esc_attr( $this->stored_api_key ); ?>" size="60"/>
40+
<button type="submit" id="api-key-submit" name="update" value="true" class="button-primary"><?php esc_html_e( 'Save Key', 'transcoder' ); ?></button>
41+
</form>
3842
</p>
3943

4044
<p>

admin/rt-transcoder-admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ public function enqueue_scripts_styles() {
201201
'disable_encoding' => esc_html__( 'Are you sure you want to disable the transcoding service?', 'transcoder' ),
202202
'enable_encoding' => esc_html__( 'Are you sure you want to enable the transcoding service?', 'transcoder' ),
203203
'something_went_wrong' => esc_html__( 'Something went wrong. Please ', 'transcoder' ) . '<a href onclick="location.reload();">' . esc_html__( 'refresh', 'transcoder' ) . '</a>' . esc_html__( ' page.', 'transcoder' ),
204+
'error_empty_key' => esc_html__( 'Please enter the license key.', 'transcoder' ),
204205
);
205206

206207
wp_localize_script( 'rt-transcoder-main', 'rt_transcoder_script', $localize_script_data );

0 commit comments

Comments
 (0)