Usage
PHP
nebula()->todo_search_files($todo_dirpath, $child)
Parameters
$todo_dirpath
(Optional) (String) The directory path to search
Default: None
$child
(Optional) (Boolean) Whether to search child theme
Default: false
Additional Notes
This function shouldn’t ever need to be called manually.
Source File
Located in /libs/Admin/Dashboard.php on line 652.
No Hooks
This function does not have any filters or actions available. Request one?Note: This function contains 2 to-do comments.
PHP
public function todo_search_files($directory=null){
$directory ??= get_template_directory();
ini_set('memory_limit', '512M'); //@todo Nebula 0: Remove these when possible...
$these_todos = array();
foreach ( $this->glob_r($directory . '/*') as $todo_file ){ //Loop through each file
if ( is_file($todo_file) ){
$todo_skipFilenames = array('README.md', 'debug_log', 'error_log', '/vendor', 'resources/'); //Skip certain filepaths and file names (more file extensions are skipped separately)
if ( !$this->contains($todo_file, $this->skip_extensions()) && !$this->contains($todo_file, $todo_skipFilenames) ){ //Skip certain extensions and filenames
foreach ( file($todo_file) as $todo_lineNumber => $todo_line ){ //Loop through each line in the file. Can the memory usage of this be reduced?
preg_match("/(@todo)\s?(?'category'[\"\'\`].+?[\"\'\`])?\s?(?'priority'\d)?:\s(?'description'.+)/i", $todo_line, $todo_details); //Separate the todo comment into useable groups
if ( !empty($todo_details) ){
$these_todos[] = array(
'directory' => $directory,
'filepath' => $todo_file,
'line_number' => $todo_lineNumber,
'line' => trim(htmlentities($todo_line)),
'priority' => ( $todo_details['priority'] === '' )? 'empty' : intval($todo_details['priority']),
'category' => ( !empty($todo_details['category']) )? str_replace(array('"', "'", '`'), '', $todo_details['category']) : '',
'description' => strip_tags(str_replace(array('-->', '?>', '*/'), '', $todo_details['description'])),
);
}
}
}
}
}
return $these_todos;
}
Override
This function can not be short-circuited with an override filter. Request one?