[PHP]Use PHP script to tidy Dojo toolkit
In the Dojo toolkit, there are some unused files so it is better to remove them.
<?php @set_time_limit(0); $target_path = getcwd().DIRECTORY_SEPARATOR.‘wp-includes‘.DIRECTORY_SEPARATOR.‘js‘.DIRECTORY_SEPARATOR.‘dojo‘; $files = list_files($target_path); foreach ($files as $file) { if(stripos($file, ‘uncompressed‘)){ echo $file; echo ‘<br>‘; @unlink($file); } } function list_files( $folder = ‘‘, $levels = 100 ) { if ( empty($folder) ) return false; if ( ! $levels ) return false; $files = array(); if ( $dir = @opendir( $folder ) ) { while (($file = readdir( $dir ) ) !== false ) { if ( in_array($file, array(‘.‘, ‘..‘) ) ) continue; if ( is_dir( $folder . ‘/‘ . $file ) ) { $files2 = list_files( $folder . ‘/‘ . $file, $levels - 1); if ( $files2 ) $files = array_merge($files, $files2 ); else $files[] = $folder . ‘/‘ . $file . ‘/‘; } else { $files[] = $folder . ‘/‘ . $file; } } } @closedir( $dir ); return $files; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。