示例#1
0
 /**
  * 
  * @param type $path
  * @param type $filter
  * @param type $recurse
  * @param type $exclude
  * @return array
  */
 public static function lsFiles($path, $filter = '.', $recurse = false, $exclude = array())
 {
     $wp_filesystem = JchPlatformCache::getWpFileSystem();
     $items = $wp_filesystem->dirlist($path, false, $recurse);
     $files = array();
     self::filterItems($path, $filter, $items, $files);
     return $files;
 }
示例#2
0
function jch_optimize_activate()
{
    $wp_filesystem = JchPlatformCache::getWpFileSystem();
    if ($wp_filesystem === false) {
        return false;
    }
    $file = $wp_filesystem->wp_plugins_dir() . '/jch-optimize/dir.php';
    $abspath = ABSPATH;
    $code = <<<PHPCODE
<?php
           
\$DIR = '{$abspath}';
           
PHPCODE;
    $wp_filesystem->put_contents($file, $code, FS_CHMOD_FILE);
}