File "acf-utility-functions.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/advanced-custom-fields/includes/acf-utility-functions.php
File
size: 1.33 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
global $acf_stores, $acf_instances;
$acf_stores = array();
$acf_instances = array();
function acf_new_instance($class = '')
{
global $acf_instances;
return $acf_instances[$class] = new $class();
}
function acf_get_instance($class = '')
{
global $acf_instances;
if (!isset($acf_instances[$class])) {
$acf_instances[$class] = new $class();
}
return $acf_instances[$class];
}
function acf_register_store($name = '', $data = false)
{
$store = new ACF_Data($data);
global $acf_stores;
$acf_stores[$name] = $store;
return $store;
}
function acf_get_store($name = '')
{
global $acf_stores;
return isset($acf_stores[$name]) ? $acf_stores[$name] : false;
}
function acf_switch_stores($site_id, $prev_site_id)
{
global $acf_stores;
foreach ($acf_stores as $store) {
$store->switch_site($site_id, $prev_site_id);
}
}
add_action('switch_blog', 'acf_switch_stores', 10, 2);
function acf_get_path($filename = '')
{
return ACF_PATH . ltrim($filename, '/');
}
function acf_get_url($filename = '')
{
if (!defined('ACF_URL')) {
define('ACF_URL', acf_get_setting('url'));
}
return ACF_URL . ltrim($filename, '/');
}
function acf_include($filename = '')
{
$file_path = acf_get_path($filename);
if (file_exists($file_path)) {
include_once $file_path;
}
}