|
@@ 1764-1766 (lines=3) @@
|
| 1761 |
|
* @return bool |
| 1762 |
|
*/ |
| 1763 |
|
public static function validate_alphanum( $value = '', $request, $param ) { |
| 1764 |
|
if ( ! empty( $value ) && ( ! is_string( $value ) || ! preg_match( '/[a-z0-9]+/i', $value ) ) ) { |
| 1765 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an alphanumeric string.', 'jetpack' ), $param ) ); |
| 1766 |
|
} |
| 1767 |
|
return true; |
| 1768 |
|
} |
| 1769 |
|
|
|
@@ 1906-1908 (lines=3) @@
|
| 1903 |
|
* @return bool |
| 1904 |
|
*/ |
| 1905 |
|
public static function validate_custom_service_id( $value = '', $request, $param ) { |
| 1906 |
|
if ( ! empty( $value ) && ( ! is_string( $value ) || ! preg_match( '/custom\-[0-1]+/i', $value ) ) ) { |
| 1907 |
|
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 ) ); |
| 1908 |
|
} |
| 1909 |
|
|
| 1910 |
|
if ( ! class_exists( 'Sharing_Service' ) && ! @include( JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php' ) ) { |
| 1911 |
|
return new WP_Error( 'invalid_param', esc_html__( 'Failed loading required dependency Sharing_Service.', 'jetpack' ) ); |
|
@@ 1935-1937 (lines=3) @@
|
| 1932 |
|
* @return bool |
| 1933 |
|
*/ |
| 1934 |
|
public static function validate_twitter_username( $value = '', $request, $param ) { |
| 1935 |
|
if ( ! empty( $value ) && ( ! is_string( $value ) || ! preg_match( '/^@?\w{1,15}$/i', $value ) ) ) { |
| 1936 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be a Twitter username.', 'jetpack' ), $param ) ); |
| 1937 |
|
} |
| 1938 |
|
return true; |
| 1939 |
|
} |
| 1940 |
|
|