| @@ -122,12 +122,8 @@ | ||
| 122 | 122 | if ( false === $check ) { |
| 123 | 123 | wp_send_json_error( __( 'Invalid security token. Please reload the page and try again.', 'sharing-image' ), 403 ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 127 | - wp_send_json_error( __( 'Sorry, you do not have permission to manage options for this site.', 'sharing-image' ), 403 ); | |
| 128 | - } | |
| 129 | - | |
| 130 | 126 | if ( ! isset( $_POST['sharing_image_index'] ) ) { |
| 131 | 127 | wp_send_json_error( __( 'Poster index is undefined.', 'sharing-image' ), 400 ); |
| 132 | 128 | } |
| 133 | 129 | |
| @@ -166,12 +162,8 @@ | ||
| 166 | 162 | if ( false === $check ) { |
| 167 | 163 | wp_send_json_error( __( 'Invalid security token. Please reload the page and try again.', 'sharing-image' ), 403 ); |
| 168 | 164 | } |
| 169 | 165 | |
| 170 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 171 | - wp_send_json_error( __( 'Sorry, you do not have permission to manage options for this site.', 'sharing-image' ), 403 ); | |
| 172 | - } | |
| 173 | - | |
| 174 | 166 | if ( ! isset( $_POST['sharing_image_index'] ) ) { |
| 175 | 167 | wp_send_json_error( __( 'Poster index is undefined.', 'sharing-image' ), 400 ); |
| 176 | 168 | } |
| 177 | 169 | |
| @@ -389,12 +381,8 @@ | ||
| 389 | 381 | if ( ! empty( $editor['height'] ) ) { |
| 390 | 382 | $sanitized['height'] = absint( $editor['height'] ); |
| 391 | 383 | } |
| 392 | 384 | |
| 393 | - $dimensions = Generator::normalize_dimensions( $sanitized['width'], $sanitized['height'] ); | |
| 394 | - $sanitized['width'] = $dimensions['width']; | |
| 395 | - $sanitized['height'] = $dimensions['height']; | |
| 396 | - | |
| 397 | 385 | if ( isset( $editor['layers'] ) && is_array( $editor['layers'] ) ) { |
| 398 | 386 | $layers = array(); |
| 399 | 387 | |
| 400 | 388 | foreach ( $editor['layers'] as $key => $layer ) { |
| @@ -458,17 +446,13 @@ | ||
| 458 | 446 | $sanitized['title'] = sanitize_text_field( $layer['title'] ); |
| 459 | 447 | } |
| 460 | 448 | |
| 461 | 449 | if ( isset( $layer['content'] ) ) { |
| 462 | - $sanitized['content'] = sanitize_textarea_field( | |
| 463 | - Generator::limit_text( Generator::normalize_text( $layer['content'] ) ) | |
| 464 | - ); | |
| 450 | + $sanitized['content'] = sanitize_textarea_field( $layer['content'] ); | |
| 465 | 451 | } |
| 466 | 452 | |
| 467 | 453 | if ( isset( $layer['sample'] ) ) { |
| 468 | - $sanitized['sample'] = sanitize_textarea_field( | |
| 469 | - Generator::limit_text( Generator::normalize_text( $layer['sample'] ) ) | |
| 470 | - ); | |
| 454 | + $sanitized['sample'] = sanitize_textarea_field( $layer['sample'] ); | |
| 471 | 455 | } |
| 472 | 456 | |
| 473 | 457 | if ( isset( $layer['separator'] ) ) { |
| 474 | 458 | $sanitized['separator'] = preg_replace( '#[^\s,]#', '', $layer['separator'] ); |
| @@ -519,9 +503,9 @@ | ||
| 519 | 503 | } |
| 520 | 504 | } |
| 521 | 505 | |
| 522 | 506 | if ( isset( $layer['fontsize'] ) ) { |
| 523 | - $sanitized['fontsize'] = min( absint( $layer['fontsize'] ), Generator::get_limit( 'max_fontsize' ) ); | |
| 507 | + $sanitized['fontsize'] = absint( $layer['fontsize'] ); | |
| 524 | 508 | } |
| 525 | 509 | |
| 526 | 510 | if ( isset( $layer['lineheight'] ) ) { |
| 527 | 511 | $sanitized['lineheight'] = (float) $layer['lineheight']; |
| @@ -527,9 +511,9 @@ | ||
| 527 | 511 | $sanitized['lineheight'] = (float) $layer['lineheight']; |
| 528 | 512 | } |
| 529 | 513 | |
| 530 | 514 | if ( isset( $layer['fontname'] ) ) { |
| 531 | - $sanitized['fontname'] = sanitize_key( $layer['fontname'] ); | |
| 515 | + $sanitized['fontname'] = sanitize_text_field( $layer['fontname'] ); | |
| 532 | 516 | } |
| 533 | 517 | |
| 534 | 518 | if ( ! empty( $layer['fontfile'] ) ) { |
| 535 | 519 | $sanitized['fontfile'] = absint( $layer['fontfile'] ); |