Code Duplication    Length = 21-21 lines in 2 locations

includes/htmlform/HTMLButtonField.php 1 location

@@ 37-57 (lines=21) @@
34
		}
35
36
		# Generate the label from a message, if possible
37
		if ( isset( $info['buttonlabel-message'] ) ) {
38
			$msgInfo = $info['buttonlabel-message'];
39
40
			if ( is_array( $msgInfo ) ) {
41
				$msg = array_shift( $msgInfo );
42
			} else {
43
				$msg = $msgInfo;
44
				$msgInfo = [];
45
			}
46
47
			$this->buttonLabel = $this->msg( $msg, $msgInfo )->parse();
48
		} elseif ( isset( $info['buttonlabel'] ) ) {
49
			if ( $info['buttonlabel'] === ' ' ) {
50
				// Apparently some things set &nbsp directly and in an odd format
51
				$this->buttonLabel = ' ';
52
			} else {
53
				$this->buttonLabel = htmlspecialchars( $info['buttonlabel'] );
54
			}
55
		} elseif ( isset( $info['buttonlabel-raw'] ) ) {
56
			$this->buttonLabel = $info['buttonlabel-raw'];
57
		}
58
59
		parent::__construct( $info );
60
	}

includes/htmlform/HTMLFormField.php 1 location

@@ 383-403 (lines=21) @@
380
		}
381
382
		# Generate the label from a message, if possible
383
		if ( isset( $params['label-message'] ) ) {
384
			$msgInfo = $params['label-message'];
385
386
			if ( is_array( $msgInfo ) ) {
387
				$msg = array_shift( $msgInfo );
388
			} else {
389
				$msg = $msgInfo;
390
				$msgInfo = [];
391
			}
392
393
			$this->mLabel = $this->msg( $msg, $msgInfo )->parse();
394
		} elseif ( isset( $params['label'] ) ) {
395
			if ( $params['label'] === ' ' ) {
396
				// Apparently some things set &nbsp directly and in an odd format
397
				$this->mLabel = ' ';
398
			} else {
399
				$this->mLabel = htmlspecialchars( $params['label'] );
400
			}
401
		} elseif ( isset( $params['label-raw'] ) ) {
402
			$this->mLabel = $params['label-raw'];
403
		}
404
405
		$this->mName = "wp{$params['fieldname']}";
406
		if ( isset( $params['name'] ) ) {