<commit_before><?php

/**
 * WordPoints_Sniffs_PHP_DisallowedFunctionsSniff.
 *
 * @package WordPoints_Dev_Lib
 * @since 2.1.0
 */

/**
 * WordPoints_Sniffs_PHP_DisallowedFunctionsSniff.
 *
 * Checks for functions that aren't allowed.
 *
 * @since 2.1.0
 */
class WordPoints_Sniffs_PHP_DisallowedFunctionsSniff
	extends WordPress_Sniffs_Functions_FunctionRestrictionsSniff {

	/**
	 * @since 2.1.0
	 */
	public function getGroups() {

		return array(
			'unserialize' => array(
				'type'      => 'error',
				'message'   => 'Do not unserialize untrusted data.',
				'functions' => array( 'unserialize', 'maybe_unserialize' ),
			),
			'wp_redirect' => array(
				'type'      => 'error',
				'message'   => 'Using wp_redirect() can lead to open redirects, use wp_safe_redirect() instead.',
				'functions' => array( 'wp_redirect' ),
			),
			'wp_remote' => array(
				'type'      => 'error',
				'message'   => 'Using wp_remote_*() can lead to unsafe internal requests, use wp_safe_remote_*() instead.',
				'functions' => array( 'wp_remote_(post|get|head|request)' ),
			),
		);
	}

} // class WordPoints_Sniffs_PHP_DisallowedFunctionsSniff<commit_msg>phpcs: Add esc_sql() to the disallowed functions<commit_after><?php

/**
 * WordPoints_Sniffs_PHP_DisallowedFunctionsSniff.
 *
 * @package WordPoints_Dev_Lib
 * @since 2.1.0
 */

/**
 * WordPoints_Sniffs_PHP_DisallowedFunctionsSniff.
 *
 * Checks for functions that aren't allowed.
 *
 * @since 2.1.0
 */
class WordPoints_Sniffs_PHP_DisallowedFunctionsSniff
	extends WordPress_Sniffs_Functions_FunctionRestrictionsSniff {

	/**
	 * @since 2.1.0
	 */
	public function getGroups() {

		return array(
			'esc_sql' => array(
				'type'      => 'error',
				'message'   => 'Do not use esc_sql(), use $wpdb->prepare() instead.',
				'functions' => array( 'esc_sql' ),
			),
			'unserialize' => array(
				'type'      => 'error',
				'message'   => 'Do not unserialize untrusted data.',
				'functions' => array( 'unserialize', 'maybe_unserialize' ),
			),
			'wp_redirect' => array(
				'type'      => 'error',
				'message'   => 'Using wp_redirect() can lead to open redirects, use wp_safe_redirect() instead.',
				'functions' => array( 'wp_redirect' ),
			),
			'wp_remote' => array(
				'type'      => 'error',
				'message'   => 'Using wp_remote_*() can lead to unsafe internal requests, use wp_safe_remote_*() instead.',
				'functions' => array( 'wp_remote_(post|get|head|request)' ),
			),
		);
	}

} // class WordPoints_Sniffs_PHP_DisallowedFunctionsSniff
{'fraction_non_alphanumeric': 0.15053763440860216, 'fraction_numerical': 0.007168458781362007, 'mean_word_length': 3.6778398510242085, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1083964', 'n_tokens_mistral': 945, 'n_tokens_neox': 835, 'n_words': 178}