plugin install

This commit is contained in:
Tony Volpe
2024-06-18 17:29:05 -04:00
parent e1aaedd1ae
commit 41f50eacc4
5880 changed files with 1057631 additions and 39681 deletions

View File

@@ -365,20 +365,16 @@ if ( ! class_exists( 'ACF_Local_JSON' ) ) :
}
/**
* Saves an ACF JSON file.
* Gets the filename for an ACF JSON file.
*
* @date 17/4/20
* @since 5.9.0
* @since 6.3
*
* @param string $key The ACF post key.
* @param array $post The main ACF post array.
* @return boolean
* @return string|boolean
*/
public function save_file( $key, $post ) {
$paths = $this->get_save_paths( $key, $post );
$file = false;
$first_writable = false;
$load_path = '';
public function get_filename( $key, $post ) {
$load_path = '';
if ( is_array( $this->files ) && isset( $this->files[ $key ] ) ) {
$load_path = $this->files[ $key ];
@@ -406,6 +402,29 @@ if ( ! class_exists( 'ACF_Local_JSON' ) ) :
return false;
}
return $filename;
}
/**
* Saves an ACF JSON file.
*
* @date 17/4/20
* @since 5.9.0
*
* @param string $key The ACF post key.
* @param array $post The main ACF post array.
* @return boolean
*/
public function save_file( $key, $post ) {
$paths = $this->get_save_paths( $key, $post );
$filename = $this->get_filename( $key, $post );
$file = false;
$first_writable = false;
if ( ! $filename ) {
return false;
}
foreach ( $paths as $path ) {
if ( ! is_writable( $path ) ) { //phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_is_writable -- non-compatible function for this purpose.
continue;
@@ -462,12 +481,17 @@ if ( ! class_exists( 'ACF_Local_JSON' ) ) :
* @return boolean
*/
public function delete_file( $key, $post = array() ) {
$paths = $this->get_save_paths( $key, $post );
$paths = $this->get_save_paths( $key, $post );
$filename = $this->get_filename( $key, $post );
if ( ! $filename ) {
return false;
}
foreach ( $paths as $path_to_check ) {
$file = untrailingslashit( $path_to_check ) . '/' . $key . '.json';
$file = untrailingslashit( $path_to_check ) . '/' . $filename;
if ( wp_is_writable( $file ) ) {
if ( is_writable( $file ) ) { //phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_is_writable -- non-compatible function for this purpose.
wp_delete_file( $file );
}
}