|
@@ 1781-1783 (lines=3) @@
|
| 1778 |
|
* @return bool |
| 1779 |
|
*/ |
| 1780 |
|
public static function validate_alphanum( $value = '', $request, $param ) { |
| 1781 |
|
if ( ! empty( $value ) && ( ! is_string( $value ) || ! preg_match( '/^[a-z0-9]+$/i', $value ) ) ) { |
| 1782 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an alphanumeric string.', 'jetpack' ), $param ) ); |
| 1783 |
|
} |
| 1784 |
|
return true; |
| 1785 |
|
} |
| 1786 |
|
|
|
@@ 1799-1801 (lines=3) @@
|
| 1796 |
|
* @return bool |
| 1797 |
|
*/ |
| 1798 |
|
public static function validate_verification_service( $value = '', $request, $param ) { |
| 1799 |
|
if ( ! empty( $value ) && ! ( is_string( $value ) && ( preg_match( '/^[a-z0-9_-]+$/i', $value ) || preg_match( '#^<meta name="([a-z0-9_\-.:]+)?" content="([a-z0-9_-]+)?" />$#i', $value ) ) ) ) { |
| 1800 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an alphanumeric string or a verification tag.', 'jetpack' ), $param ) ); |
| 1801 |
|
} |
| 1802 |
|
return true; |
| 1803 |
|
} |
| 1804 |
|
|
|
@@ 1941-1943 (lines=3) @@
|
| 1938 |
|
* @return bool |
| 1939 |
|
*/ |
| 1940 |
|
public static function validate_custom_service_id( $value = '', $request, $param ) { |
| 1941 |
|
if ( ! empty( $value ) && ( ! is_string( $value ) || ! preg_match( '/custom\-[0-1]+/i', $value ) ) ) { |
| 1942 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( "%s must be a string prefixed with 'custom-' and followed by a numeric ID.", 'jetpack' ), $param ) ); |
| 1943 |
|
} |
| 1944 |
|
|
| 1945 |
|
if ( ! class_exists( 'Sharing_Service' ) && ! @include( JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php' ) ) { |
| 1946 |
|
return new WP_Error( 'invalid_param', esc_html__( 'Failed loading required dependency Sharing_Service.', 'jetpack' ) ); |
|
@@ 1970-1972 (lines=3) @@
|
| 1967 |
|
* @return bool |
| 1968 |
|
*/ |
| 1969 |
|
public static function validate_twitter_username( $value = '', $request, $param ) { |
| 1970 |
|
if ( ! empty( $value ) && ( ! is_string( $value ) || ! preg_match( '/^@?\w{1,15}$/i', $value ) ) ) { |
| 1971 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a Twitter username.', 'jetpack' ), $param ) ); |
| 1972 |
|
} |
| 1973 |
|
return true; |
| 1974 |
|
} |
| 1975 |
|
|