| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/blocksy/admin/helpers/ |
Upload File : |
<?php
/**
* Return the url to be used in image picker.
*
* @param string $path image name.
*/
if (! function_exists('blocksy_image_picker_url')) {
function blocksy_image_picker_url($path) {
return get_template_directory_uri() . '/static/images/' . $path;
}
}
/**
* Parse options.
*
* @param array $result The place to store result into.
* @param array $options Proper options.
* @param array $settings settings.
* @param array $_recursion_data (private) for internal use.
*/
function blocksy_collect_options(
&$result,
&$options,
$settings = [],
$_recursion_data = []
) {
static $default_settings = [
/**
* If true:
* $result = array(
* '(container|option):{id}' => array(
* 'id' => '{id}',
* 'level' => int, // from which nested level this option is
* 'group' => 'container|option',
* 'option' => array(...),
* )
* )
*
* @type bool Wrap the result/collected options in arrays will useful info
*
* If false:
* $result = array(
* '{id}' => array(...),
* // Warning: There can be options and containers with the same id (array key will be replaced)
* )
*/
'info_wrapper' => false,
/**
* For e.g. use 1 to collect only first level. 0 is for unlimited.
*
* @type int Nested options level limit.
*/
'limit_level' => 0,
/**
* Empty array will skip all types
*
* @type false|array('option-type', ...)
*/
'limit_option_types' => false,
'include_container_types' => true,
'include_inner_options' => false
];
if (empty($options)) {
return;
}
if (empty($_recursion_data)) {
$settings = array_merge($default_settings, $settings);
$_recursion_data = [
'level' => 1,
];
}
if (
$settings['limit_level']
&&
$_recursion_data['level'] > $settings['limit_level']
) {
return;
}
foreach ($options as $option_id => &$option) {
if (isset($option['options'])) { // this is a container.
do {
if ($settings['info_wrapper']) {
if ($settings['include_container_types']) {
$result['container:' . $option_id] = [
'group' => 'container',
'id' => $option_id,
'option' => &$option,
'level' => $_recursion_data['level'],
];
}
} else {
if ($settings['include_container_types']) {
$result[$option_id] = &$option;
}
}
} while (false);
blocksy_collect_options(
$result,
$option['options'],
$settings,
array_merge(
$_recursion_data,
['level' => $_recursion_data['level'] + 1]
)
);
} elseif (
is_int($option_id)
&&
is_array($option)
&&
isset($options[0])
) {
blocksy_collect_options($result, $option, $settings, $_recursion_data);
} elseif (isset($option['type'])) { // option.
if (
is_array($settings['limit_option_types'])
&&
! in_array($option['type'], $settings['limit_option_types'], true)
) {
continue;
}
if ($settings['info_wrapper']) {
$result['option:' . $option_id] = [
'group' => 'option',
'id' => $option_id,
'option' => &$option,
'level' => $_recursion_data['level'],
];
} else {
$result[$option_id] = &$option;
}
if (
$settings['include_inner_options']
&&
isset($option['inner-options'])
) {
blocksy_collect_options(
$result,
$option['inner-options'],
$settings,
array_merge(
$_recursion_data,
['level' => $_recursion_data['level'] + 1]
)
);
}
} else {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
trigger_error(
'Invalid option: ' . esc_html( $option_id ),
E_USER_WARNING
);
}
}
}
function blocksy_get_options($path, $pass_inside = [], $relative = true) {
if ($relative) {
$path = get_template_directory() . '/inc/options/' . $path . '.php';
}
if (! file_exists($path)) {
return null;
}
return apply_filters('blocksy:options:retrieve', blocksy_akg(
'options',
blocksy_get_variables_from_file(
$path,
['options' => []],
$pass_inside
)
), $path, $pass_inside);
}