<?php
    // prevent direct file access
	if( !defined( 'ABSPATH' ) ) exit;
    
    // template script
    function pixe_plugin_settings_sites_script(){
        pixe_enqueue_admin_styles(array('utility', 'preset', 'settings'));
        pixe_enqueue_admin_scripts(array('jquery', 'utility', 'site-settings'));
        wp_localize_script('pixe-block-settings', 'pixeData', pixe_plugin_settings_script_data(array('sites')));
    }

    // content area
    function pixe_print_plugin_settings_sites_script(){
?>
(function($){
    "use strict";

    $(document).ready(function(){
        var t = $.pixeBlockSettings;

        var container = $('<div class="pixe-template-settings pixe-box-sizing" ></div>');
        var tab = $('<div class="pixe-settings-tab" ></div>');
        tab.appendTo(container);

        t.tabHead = $('<div class="pixe-settings-tab-head" ></div>');
        t.tabHead.append('<span data-tab="sites" class="pixe-text" >' + pixei18n.template.siteLibrary + '<span class="pixe-caption" >' + pixei18n.template.siteLibraryCaption + '</span></span>');
        tab.append(t.tabHead);

        var tabHeadRight = $('<div class="pixe-settings-tab-head-right" ></div>');
        tabHeadRight.append($.pixeGetAdminIcon('favourite', { data: 'data-tab="favourites"' }));
        tabHeadRight.appendTo(t.tabHead);

        t.tabContent = $('<div class="pixe-settings-tab-content" ></div>');
        tab.append(t.tabContent);

        $('#pixe-plugin-settings-content').each(function(){
            $(this).append(container);
        });

        t.hideInsertButton = true;
        
        t.changeTab('sites');
        t.tabHead.on('click', '[data-tab]', function(){
            var tab = $(this).attr('data-tab');
            if( $(this).hasClass('pixe-active') && tab == 'favourites' ){
                t.changeTab('sites');
            }else{
                t.changeTab(tab);
            }
        });
    });
})(jQuery);
<?php
    }
    function pixe_plugin_settings_sites(){
        pixe_plugin_settings_head('sites');

        echo '<div class="pixe-plugin-settings-content pixe-style-tab-head-text" id="pixe-plugin-settings-content" ></div>';
        ob_start();
        pixe_print_plugin_settings_sites_script();
        wp_add_inline_script('pixe-inline', ob_get_clean());
    }