Skip to content

Commit

Permalink
Merge branch 'develop' into fix/SIT-5796
Browse files Browse the repository at this point in the history
  • Loading branch information
MARQAS authored Feb 20, 2024
2 parents 0efb1a3 + 2dc8879 commit 53b8d0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions includes/admin/api/class-bc-admin-media-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ public function bc_ajax_update_video_or_playlist() {

} elseif ( 'videos' === $_POST['type'] ) {
$type_msg = 'video';
if ( 'variant' === $_POST['sub_type'] ) {
$status = $this->videos->update_bc_video( $updated_data, sanitize_text_field( $_POST['sub_type'] ) );
$sub_type = isset( $_POST['sub_type'] ) ? sanitize_text_field( $_POST['sub_type'] ) : '';
if ( 'variant' === $sub_type ) {
$status = $this->videos->update_bc_video( $updated_data, $sub_type );
} else {
$status = $this->videos->update_bc_video( $updated_data );

Expand Down
7 changes: 4 additions & 3 deletions includes/admin/class-bc-admin-labels-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct() {
* Renders html of the edit labels page
*/
public function render_edit_label_page() {
$label_name = isset( $_GET['update_label'] ) ? $_GET['update_label'] : ''; // phpcs:ignore WordPress.Security.NonceVerification
?>
<div class="wrap">
<h2>
Expand All @@ -46,13 +47,13 @@ public function render_edit_label_page() {
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="validate">
<?php wp_nonce_field( 'brightcove-edit-label', 'brightcove-edit-label-nonce' ); ?>
<input type="hidden" name="action" value="brightcove-edit-label">
<input type="hidden" name="label-path" value="<?php echo ! empty( $_GET['update_label'] ) ? esc_attr( $_GET['update_label'] ) : ''; // phpcs:ignore ?>">
<input type="hidden" name="label-path" value="<?php echo esc_attr( $label_name ); ?>">
<table class="form-table">
<tbody>
<tr class="form-field form-required term-name-wrap">
<th scope="row"><label for="name">Label</label></th>
<th scope="row"><label for="name"><?php esc_html_e( 'Label', 'brightcove' ); ?></label></th>
<td>
<input name="label-update" id="name" type="text" value="<?php echo esc_attr( end( array_filter( explode( '/', $_GET['update_label'] ) ) ) ); ?>" size="40" aria-required="true"> <?php // phpcs:ignore WordPress.Security.NonceVerification ?>
<input name="label-update" id="name" type="text" value="<?php echo esc_attr( basename( trim( $label_name, '/' ) ) ); ?>" size="40" aria-required="true">
<p class="description"><?php esc_html_e( 'Enter the new label name.', 'brightcove' ); ?></p>
</td>
</tr>
Expand Down
11 changes: 9 additions & 2 deletions includes/class-bc-labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,15 @@ public function add_label() {
) {
$label_name = sanitize_text_field( $_POST['label-name'] );
$label_path = ! empty( $_POST['label-path'] ) ? $_POST['label-path'] : '';
$this->cms_api->add_label( $label_name, $label_path );
wp_safe_redirect( admin_url( 'admin.php?page=brightcove-labels&add_label=1&refresh_labels=1' ) );

$redirect_url = admin_url( 'admin.php?page=brightcove-labels&refresh_labels=1' );

if ( ! empty( $label_name ) || ! empty( $label_path ) ) {
$this->cms_api->add_label( $label_name, $label_path );
$redirect_url = add_query_arg( 'add_label', '1', $redirect_url );
}

wp_safe_redirect( $redirect_url );
exit;
}
}
Expand Down

0 comments on commit 53b8d0f

Please sign in to comment.