| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/header-footer/admin/ |
Upload File : |
<?php
defined('ABSPATH') || exit;
add_action('admin_init', function () {
global $hefo_options;
if (isset($hefo_options['page_add_tags'])) {
register_taxonomy_for_object_type('post_tag', 'page');
}
if (isset($hefo_options['page_add_categories'])) {
register_taxonomy_for_object_type('category', 'page');
}
});
add_action('admin_menu', function () {
add_options_page('Head and Footer', 'Head and Footer', 'manage_options', 'hefo', function () {
$subpage = $_GET['subpage'] ?? '';
switch ($subpage) {
case 'settings':
include __DIR__ . '/options.php';
break;
case 'more':
include __DIR__ . '/more.php';
break;
default:
include __DIR__ . '/options.php';
}
});
});
if (isset($_GET['page']) && $_GET['page'] === 'hefo') {
header('X-XSS-Protection: 0');
add_action('admin_enqueue_scripts', function () {
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_style('hefo', plugins_url('header-footer') . '/admin/admin.css', [], time());
wp_enqueue_style('hefo-jquery-ui', plugins_url('header-footer') . '/vendor/jquery-ui/jquery-ui.min.css', [], time());
wp_enqueue_code_editor(['type' => 'php']);
wp_enqueue_script('jquery-ui-tabs');
});
}
add_action('add_meta_boxes', function () {
add_meta_box('hefo', __('Head and Footer', 'header-footer'), 'hefo_meta_boxes_callback', ['post', 'page']);
});
add_action('save_post', 'hefo_save_post');
function hefo_meta_boxes_callback($post) {
// Use nonce for verification
wp_nonce_field(plugin_basename(__FILE__), 'hefo');
// The actual fields for data entry
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
$before = get_post_meta($post->ID, 'hefo_before', true);
$after = get_post_meta($post->ID, 'hefo_after', true);
echo '<label>';
echo '<input type="checkbox" id="hefo_before" name="hefo_before" ' . (empty($before) ? "" : "checked") . '> ';
esc_html_e("Disable top injection", 'header-footer');
echo '</label> ';
echo '<br>';
echo '<label>';
echo '<input type="checkbox" id="hefo_after" name="hefo_after]" ' . (empty($after) ? "" : "checked") . '> ';
esc_html_e("Disable bottom injection", 'header-footer');
echo '</label> ';
}
function hefo_save_post($post_id) {
if (!isset($_POST['hefo']))
return;
// First we need to check if the current user is authorised to do this action.
if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id))
return;
} else {
if (!current_user_can('edit_post', $post_id))
return;
}
// Secondly we need to check if the user intended to change this value.
if (!wp_verify_nonce($_POST['hefo'], plugin_basename(__FILE__)))
return;
update_post_meta($post_id, 'hefo_before', isset($_REQUEST['hefo_before']) ? 1 : 0);
update_post_meta($post_id, 'hefo_after', isset($_REQUEST['hefo_after']) ? 1 : 0);
}