Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,33 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff {
* @var array
*/
public $getPathFunctions = [
'plugin_dir_path',
'dirname',
'get_404_template',
'get_archive_template',
'get_attachment_template',
'get_author_template',
'get_category_template',
'get_date_template',
'get_embed_template',
'get_front_page_template',
'get_page_template',
'get_paged_template', // Deprecated, but should still be accepted for the purpose of this sniff.
'get_home_template',
'get_index_template',
'get_parent_theme_file_path',
'get_privacy_policy_template',
'get_query_template',
'get_search_template',
'get_single_template',
'get_singular_template',
'get_stylesheet_directory',
'get_tag_template',
'get_taxonomy_template',
'get_template_directory',
'locate_template',
'get_parent_theme_file_path',
'get_theme_file_path',
'locate_block_template',
'locate_template',
'plugin_dir_path',
];

/**
Expand Down
7 changes: 6 additions & 1 deletion WordPressVIPMinimum/Tests/Files/IncludingFileUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ include_once dir_function(); // Error - custom functionm with keyword from $al
require CUSTOM_CONSTANT_DIR . 'file.php'; // OK.
require_once ( VIPCS_PATH ) . 'file.php'; // OK.
include_once
DIR_CUSTOM , 'file.php'; // OK.
DIR_CUSTOM , 'file.php'; // OK.

// These are valid (previously false positives).
include( get_404_template() );
require get_query_template( 'post' );
include_once locate_block_template( __DIR__, 'silly_block' );