HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/test.kaunokolegija.lt/kk_wp_content/updraft/plugins-old/kk_metabox/metabox.php
<?php

if (file_exists(__DIR__ . '/cmb2/init.php')) {
    require_once __DIR__ . '/cmb2/init.php';
} elseif (file_exists(__DIR__ . '/CMB2/init.php')) {
    require_once __DIR__ . '/CMB2/init.php';
}

if (file_exists(__DIR__ . '/cmb2/init.php')) {
    require_once __DIR__ . '/cmb2-attached-posts-master/cmb2-attached-posts-field.php';
} elseif (file_exists(__DIR__ . '/CMB2/init.php')) {
    require_once __DIR__ . '/cmb2-attached-posts-master/cmb2-attached-posts-field.php';
}

require_once __DIR__ . '/link-picker/plugin.php';
require_once __DIR__ . '/cmb_field_map/cmb-field-map.php';
require_once __DIR__ . '/cmb2-switch-button/switch_metafield.php';

/**
 * Define the metabox and field configurations.
 */

add_action('cmb2_admin_init', 'kk_options');

function kk_options()
{
    $prefix = 'kk_options_';

    $kk_metabox_mainpage = new_cmb2_box(array(
        'id' => $prefix . 'main_page',
        'title' => __('Pagrindionio pusl', 'kaunokolegija'),
        'object_types' => array('kk_options')
    ));

    $kk_metabox = $kk_metabox_mainpage->add_field(array(
        'id' => $prefix . 'textfield',
        'name' => __('Dėstomo dalyko pavadinimas', 'kaunokolegija'),
        'type' => 'text'
    ));

}

/**
 * KK custom metabox for studiju programa post type
 *
 * @version   1.0.0
 */

add_action('cmb2_admin_init', 'kk_stud_prog_metaboxes');

function kk_stud_prog_metaboxes()
{

    $prefix = '_kk_stud_prog_';

    $kk_metabox_group = new_cmb2_box(array(
        'id' => $prefix . 'stud_repeater_box',
        'title' => __('Apie Studijų Kryptį', 'kaunokolegija'),
        'object_types' => array('kk_stujuprograma')
    ));

    $kk_metabox = new_cmb2_box(array(
        'id' => $prefix . 'stud_meta',
        'title' => __('Įrašo būsena', 'kaunokolegija'),
        'object_types' => array('kk_stujuprograma',)// Post type
    ));

    $example_meta = new_cmb2_box(array(
        'id' => $prefix . 'attached_posts_field',
        'title' => __('Priskirti dėstytojus', 'cmb2'),
        'object_types' => array('kk_stujuprograma'), // Post type
        'context' => 'normal',
        'priority' => 'high',
        'show_names' => false, // Show field names on the left
    ));

    $example_meta->add_field(array(
        'name' => __('Pridėti įrašą', 'kaunokolegija'),
        'id' => $prefix . 'attached_attached_posts',
        'type' => 'custom_attached_posts',
        'options' => array(
            'show_thumbnails' => true, // Show thumbnails on the left
            'filter_boxes' => true, // Show a text box for filtering the results
            'query_args' => array(
                'posts_per_page' => -1,
                'post_type' => 'kk_destitojai',
            ),
        ),
    ));

    $group_field_id = $kk_metabox_group->add_field(array(
        'id' => $prefix . '_repeat_group',
        'type' => 'group',
        'priority' => 'high',
        'options' => array(
            'group_title' => __('Pastraipa {#}', 'kaunokolegija'),
            'add_button' => __('Pridėti naują pastaipą', 'kaunokolegija'),
            'remove_button' => __('Ištrinti pastraipą', 'kaunokolegija'),
            'sortable' => true,
            'closed' => true,
        ),
    ));

    $kk_metabox_group->add_group_field($group_field_id, array(
        'name' => 'Pastraipos antraštė',
        'id' => $prefix . 'title',
        'type' => 'text',
    ));

    $kk_metabox_group->add_group_field($group_field_id, array(
        'name' => 'Pastraipos turinys',
        'description' => __('Pastraipos tekstas', 'kaunokolegija'),
        'id' => $prefix . 'description',
        'type' => 'wysiwyg',
    ));

    $kk_metabox->add_field(array(
        'name' => 'Išsirinkti įrašo būsena',
        'id' => $prefix . 'radio_field',
        'type' => 'radio',
        'show_option_none' => true,
        'options' => array(
            'naujas' => __('Naujas', 'kaunokolegija'),
            'planuojamas' => __('Planuojamas', 'kaunokolegija'),
        ),
    ));

    $kk_metabox->add_field(array(
        'name' => 'Naujos būsenos tekstas',
        'id' => $prefix . 'naujos_tekstas_field',
        'type' => 'text',
        'description' => __('Naujos būsenos tekstas', 'kaunokolegija'),
    ));

    $kk_metabox->add_field(array(
        'name' => 'Planuojamos būsenos tekstas',
        'id' => $prefix . 'planuojamos_tekstas_field',
        'type' => 'text',
        'description' => __('Planuojamos būsenos tekstas', 'kaunokolegija'),
    ));

    $kk_metabox->add_field(array(
        'name' => __('Išrinkti įrašą kaip populiariausią', 'kaunokolegija'),
        'id' => $prefix . 'is_popular',
        'type' => 'checkbox'
    ));

    $kk_search = new_cmb2_box(array(
        'id' => $prefix . 'search',
        'title' => __('Paieškos rezultatų nustatymai', 'kaunokolegija'),
        'object_types' => array('kk_stujuprograma',),// Post type
        'priority' => 'low',
    ));

    $kk_search->add_field(array(
        'name' => __('Paieškos rezutatų trumpinys'),
        'id' => $prefix . 'search_excerpt',
        'type' => 'wysiwyg'
    ));
}

/**
 * KK custom metabox for page post type
 *
 * @version   1.0.0
 */

add_action('cmb2_admin_init', 'kk_page_banner_metabox');

function kk_page_banner_metabox()
{
    $prefix = 'kk_banner_text_';

    $kk_banner = new_cmb2_box(array(
        'id' => $prefix . 'banner_text',
        'title' => __('Spec. paveikslėlio tekstas', 'kaunokolegija'),
        'object_types' => array('page', 'kk_stujuprograma'),
        'priority' => 'low',
    ));

    $kk_banner->add_field(array(
        'name' => 'Spec. paveikslėlio antraštė',
        'id' => $prefix . 'bannerio_antraste',
        'type' => 'text',
        'desc' => __('Jaigu bus nenurodytas, tai bus naudojamas pagrindinis įrašo pavadinimas', 'kaunokolegija'),
    ));

    $kk_banner->add_field(array(
        'name' => 'Spec. paveikslėlio aprašymas',
        'id' => $prefix . 'bannerio_aprasymas',
        'type' => 'textarea'
    ));

    $kk_banner->add_field(array(
        'name' => 'Spec. paveikslėlio išvaizda',
        'id' => $prefix . 'bannerio_isvaizda',
        'type' => 'radio',
        'show_option_none' => __('Pagrindinis', 'kaunokolegija'),
        'options' => array(
            'standard' => __('Juodas', 'kaunokolegija'),
        ),
    ));
}

/**
 * KK custom metabox for event post type
 *
 * @version   1.0.0
 */

add_action('cmb2_admin_init', 'kk_events');


function kk_events()
{
    $prefix = "kk_events_";

    $kk_events = new_cmb2_box(array(
        'id' => $prefix . 'event_metabox',
        'title' => __('Renginio data', 'kaunokolegija'),
        'object_types' => array('kk_renginiai'),
    ));

    $kk_events->add_field(array(
        'name' => __('Renginio pradžios data', 'kk_metabox'),
        'id' => $prefix . 'event_start_date',
        'type' => 'text_date',
        'date_format' => 'Y-m-d',
        'attributes' => array(
            'required' => 'sits laukas butinas',
        ),
    ));

    $kk_events->add_field(array(
        'name' => __('Renginio pabaigos data', 'kk_metabox'),
        'id' => $prefix . 'event_end_date',
        'type' => 'text_date',
        'date_format' => 'Y-m-d',
        'attributes' => array(
            'required' => 'required',
        ),
    ));
}