← All changes
|
modules/widgets/milestone/class-milestone-widget.php
+7
-2
12.7.3
→
16.3-a.7
View file →
| @@ -6,8 +6,12 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | use Automattic\Jetpack\Assets; |
| 9 | 9 | |
| 10 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 11 | + exit( 0 ); | |
| 12 | +} | |
| 13 | + | |
| 10 | 14 | /** |
| 11 | 15 | * Class Milestone_Widget |
| 12 | 16 | */ |
| 13 | 17 | class Milestone_Widget extends WP_Widget { |
| @@ -134,11 +138,11 @@ | ||
| 134 | 138 | public static function sanitize_color_hex( $hex, $prefix = '#' ) { |
| 135 | 139 | $hex = trim( $hex ); |
| 136 | 140 | |
| 137 | 141 | /* Strip recognized prefixes. */ |
| 138 | - if ( 0 === strpos( $hex, '#' ) ) { | |
| 142 | + if ( str_starts_with( $hex, '#' ) ) { | |
| 139 | 143 | $hex = substr( $hex, 1 ); |
| 140 | - } elseif ( 0 === strpos( $hex, '%23' ) ) { | |
| 144 | + } elseif ( str_starts_with( $hex, '%23' ) ) { | |
| 141 | 145 | $hex = substr( $hex, 3 ); |
| 142 | 146 | } |
| 143 | 147 | |
| 144 | 148 | if ( 0 !== preg_match( '/^[0-9a-fA-F]{6}$/', $hex ) ) { |
| @@ -631,8 +635,9 @@ | ||
| 631 | 635 | /** |
| 632 | 636 | * Form |
| 633 | 637 | * |
| 634 | 638 | * @param array $instance Widget instance. |
| 639 | + * @return string|void | |
| 635 | 640 | */ |
| 636 | 641 | public function form( $instance ) { |
| 637 | 642 | $instance = $this->sanitize_instance( $instance ); |
| 638 | 643 | |