芝麻web文件管理V1.00
编辑当前文件:/home/r5772835/public_html/dina.ycreate.jp/wp-content/themes/snow-monkey/Framework/Model/Cache.php
%2$s [name] => %3$s --> %1$s ', $cache, esc_html( $slug ), esc_html( $name ) ); } /** * Save the cache. * * @param string $directory The directory where the cache is stored. * @param string $data The template HTML. * @param string $slug The template slug. * @param string $name The template name. * @param array $vars The template $args. * @param string $ext Cache file extention. * @return boolean */ public static function save( $directory, $data, $slug, $name = '', $vars = array(), $ext = 'html' ) { $cache_filepath = static::get_cache_filepath( $directory, $slug, $name, $vars, $ext ); if ( file_exists( $cache_filepath ) ) { return true; } $cache_directory = static::get_cache_directory( $directory ); if ( ! file_exists( $cache_directory ) ) { Filesystem::mkdir( $cache_directory ); } return is_writable( $cache_directory ) ? Filesystem::put_contents( $cache_filepath, $data ) : false; } /** * Return the cache filepath. * * @param string $directory The directory where the cache is stored. * @param string $slug The template slug. * @param string $name The template name. * @param array $vars The template $args. * @param string $ext Cache file extention. * @return string */ public static function get_cache_filepath( $directory, $slug, $name = '', $vars = array(), $ext = 'html' ) { $cache_flename = static::get_filename( $slug, $name, $vars, $ext ); $cache_directory = static::get_cache_directory( $directory ); $cache_filepath = trailingslashit( $cache_directory ) . $cache_flename; return $cache_filepath; } /** * Return cache directory. * * @param string $directory The directory where the cache is stored. * @return string */ public static function get_cache_directory( $directory ) { $base_directory = static::get_base_directory(); $cache_directory = $directory ? path_join( $base_directory, $directory ) : $base_directory; return $cache_directory; } }