HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpdeskera/wp-content/plugins/elementor-addon-components/includes/acf/eac-acf-json.php
<?php
/**
 * Description: Cette pièce de code (les deux filtres) modifie le chemin de sauvegarde
 * du répertoire 'acf-json' normalement situé dans le thème courant
 * Maintenant localisé dans le répertoire '/includes/acf' du plugin
 *
 * @since 1.8.7
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

add_filter( 'acf/settings/save_json', 'eac_acf_json_save_point' );
add_filter( 'acf/settings/load_json', 'eac_acf_json_load_point' );

function eac_acf_json_save_point( $path ) {
	// check le répertoire 'acf-json' du thème
	if ( is_writable( get_stylesheet_directory() . '/acf-json' ) ) {
		return $path;
	}

	// check le répertoire 'acf-json' du plugin
	if ( ! is_writable( EAC_ACF_JSON_PATH ) ) {
		if ( ! eac_create_json_dir() ) {
			return $path;
		}
	}

	// Update path
	$path = EAC_ACF_JSON_PATH;

	return $path;
}

/**
 * Register the path to load the ACF json files so that they are version controlled.
 *
 * @param $paths The default relative path to the folder where ACF saves the files.
 * @return string The new relative path to the folder where we are saving the files.
 */
function eac_acf_json_load_point( $paths ) {
	// check le répertoire 'acf-json' du thème
	if ( is_writable( get_stylesheet_directory() . '/acf-json' ) ) {
		return $paths;
	}

	// check le répertoire 'acf-json' du plugin
	if ( ! is_writable( EAC_ACF_JSON_PATH ) ) {
		if ( ! eac_create_json_dir() ) {
			return $paths; }
	}

	// Remove original path
	unset( $paths[0] );

	// Append our new path
	$paths[] = EAC_ACF_JSON_PATH;

	return $paths;
}

/**
 * Création du répertoire 'acf-json' et du fichier index.php
 */
function eac_create_json_dir() {
	$ok = mkdir( EAC_ACF_JSON_PATH, 0755 );
	if ( $ok ) {
		// création du fichier index
		$f = fopen( EAC_ACF_JSON_PATH . '/index.php', 'w' );
		// écriture
		fwrite( $f, "<?php\r\n" );
		fwrite( $f, "// Silence is golden.\r\n" );
		fwrite( $f, '?>' );
		// fermeture
		fclose( $f );
	}

	return $ok;
}