Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_AssetCache::cache_file( string $filename, string $contents )
Cache file contents.
Description Description
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Parameters Parameters
- $filename
-
(Required) Filename of file to generate.
- $contents
-
(Required) Contents to put into file.
Return Return
(bool)
Source Source
File: classes/AssetCache.php
public static function cache_file( $filename, $contents ) { if ( false === self::$cache_dir ) { return false; } if ( ! function_exists( 'WP_Filesystem' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); } $file = trailingslashit( self::$cache_dir ) . $filename; WP_Filesystem(); /** @var WP_Filesystem_Base $wp_filesystem */ global $wp_filesystem; $results = $wp_filesystem->put_contents( $file, $contents, defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : false ); // If the file is generated and is accessible... if ( true === $results && self::is_file_accessible( $filename ) ) { return true; } else { // ... else, let's set our flags to prevent cache running again for now. update_option( 'pum_files_writeable', false ); update_option( '_pum_writeable_notice_dismissed', false ); return false; } }
Expand full source code Collapse full source code View on Trac