PluginProbe
Plugin Check (PCP) / 1.5.0
Plugin Check (PCP) v1.5.0
2.1.0 trunk 0.1 0.2.0 0.2.1 0.2.2 0.2.3 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.3.0 1.3.1 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 ci-artifacts
plugin-check / includes / Checker / Checks / Plugin_Repo / Offloading_Files_Check.php

Offloading_Files_Check.php in Plugin Check (PCP) 1.5.0, at includes/Checker/Checks/Plugin_Repo/Offloading_Files_Check.php

89 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Offloading_Files.
4 *
5 * @package plugin-check
6 */
7
8 namespace WordPress\Plugin_Check\Checker\Checks\Plugin_Repo;
9
10 use WordPress\Plugin_Check\Checker\Check_Categories;
11 use WordPress\Plugin_Check\Checker\Check_Result;
12 use WordPress\Plugin_Check\Checker\Checks\Abstract_PHP_CodeSniffer_Check;
13 use WordPress\Plugin_Check\Traits\Amend_Check_Result;
14 use WordPress\Plugin_Check\Traits\Stable_Check;
15
16 /**
17 * Check to detect loading files from external sites.
18 *
19 * @since 1.2.0.
20 */
21 class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check {
22
23 use Amend_Check_Result;
24 use Stable_Check;
25
26 /**
27 * Bitwise flags to control check behavior.
28 *
29 * @since 1.2.0.
30 * @var int
31 */
32 protected $flags = 0;
33
34 /**
35 * Gets the categories for the check.
36 *
37 * Every check must have at least one category.
38 *
39 * @since 1.2.0.
40 *
41 * @return array The categories for the check.
42 */
43 public function get_categories() {
44 return array( Check_Categories::CATEGORY_PLUGIN_REPO );
45 }
46
47 /**
48 * Returns an associative array of arguments to pass to PHPCS.
49 *
50 * @since 1.0.0
51 *
52 * @param Check_Result $result The check result to amend, including the plugin context to check.
53 * @return array An associative array of PHPCS CLI arguments.
54 */
55 protected function get_args( Check_Result $result ) {
56 return array(
57 'extensions' => 'php',
58 'standard' => 'PluginCheck',
59 'sniffs' => 'PluginCheck.CodeAnalysis.EnqueuedResourceOffloading,PluginCheck.CodeAnalysis.Offloading',
60 );
61 }
62
63 /**
64 * Gets the description for the check.
65 *
66 * Every check must have a short description explaining what the check does.
67 *
68 * @since 1.2.0.
69 *
70 * @return string Description.
71 */
72 public function get_description(): string {
73 return __( 'Prevents using remote services that are not necessary.', 'plugin-check' );
74 }
75
76 /**
77 * Gets the documentation URL for the check.
78 *
79 * Every check must have a URL with further information about the check.
80 *
81 * @since 1.2.0.
82 *
83 * @return string The documentation URL.
84 */
85 public function get_documentation_url(): string {
86 return __( 'https://developer.wordpress.org/plugins/wordpress-org/common-issues/#calling-files-remotely', 'plugin-check' );
87 }
88 }
89