HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: 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,
Upload Files
File: /home/bookcc/public_html/wp-content/themes/fatmoon/advance/walkers/left-right-no-menu.php
<?php
/**
 * A13FRAMEWORK_page_tree_one_line_left_walker
 * Used in main menu for one line header when no menu is defined
 */
class A13FRAMEWORK_page_tree_one_line_left_walker extends Walker_Page {
    /**
     * @param array $elements all menu items
     * @param int   $max_depth
     *
     * @return string items html
     */
    public function walk( $elements, $max_depth ) {
        $number_of_root_elements = $this->get_number_of_root_elements($elements);
        //copy of source of parent::walk function

        $args = array_slice(func_get_args(), 2);
        $output = '';

        //invalid parameter or nothing to walk
        if ( $max_depth < -1 || empty( $elements ) ) {
            return $output;
        }

        $parent_field = $this->db_fields['parent'];

        // flat display
        if ( -1 == $max_depth ) {
            $empty_array = array();
            foreach ( $elements as $e )
                $this->display_element( $e, $empty_array, 1, 0, $args, $output );
            return $output;
        }

        /*
		 * Need to display in hierarchical order.
		 * Separate elements into two buckets: top level and children elements.
		 * Children_elements is two dimensional array, eg.
		 * Children_elements[10][] contains all sub-elements whose parent is 10.
		 */
        $top_level_elements = array();
        $children_elements  = array();
        foreach ( $elements as $e) {
            if ( empty( $e->$parent_field ) )
                $top_level_elements[] = $e;
            else
                $children_elements[ $e->$parent_field ][] = $e;
        }

        /*
		 * When none of the elements is top level.
		 * Assume the first one must be root of the sub elements.
		 */
        if ( empty($top_level_elements) ) {

            $first = array_slice( $elements, 0, 1 );
            $root = $first[0];

            $top_level_elements = array();
            $children_elements  = array();
            foreach ( $elements as $e) {
                if ( $root->$parent_field == $e->$parent_field )
                    $top_level_elements[] = $e;
                else
                    $children_elements[ $e->$parent_field ][] = $e;
            }
        }

        $current_index = 1;
        foreach ( $top_level_elements as $e ){
            if( $current_index <= ceil($number_of_root_elements/2) ){
                $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
            }
            $current_index++;
        }

        return $output;
	}
}



/**
 * A13FRAMEWORK_page_tree_one_line_right_walker
 * Used in main menu for one line header when no menu is defined
 */
class A13FRAMEWORK_page_tree_one_line_right_walker extends Walker_Page {
	/**
     * @param array $elements all menu items
     * @param int   $max_depth
     *
     * @return string items html
     */
    public function walk( $elements, $max_depth ) {
        $number_of_root_elements = $this->get_number_of_root_elements($elements);
        //copy of source of parent::walk function

        $args = array_slice(func_get_args(), 2);
        $output = '';

        //invalid parameter or nothing to walk
        if ( $max_depth < -1 || empty( $elements ) ) {
            return $output;
        }

        $parent_field = $this->db_fields['parent'];

        // flat display
        if ( -1 == $max_depth ) {
            $empty_array = array();
            foreach ( $elements as $e )
                $this->display_element( $e, $empty_array, 1, 0, $args, $output );
            return $output;
        }

        /*
		 * Need to display in hierarchical order.
		 * Separate elements into two buckets: top level and children elements.
		 * Children_elements is two dimensional array, eg.
		 * Children_elements[10][] contains all sub-elements whose parent is 10.
		 */
        $top_level_elements = array();
        $children_elements  = array();
        foreach ( $elements as $e) {
            if ( empty( $e->$parent_field ) )
                $top_level_elements[] = $e;
            else
                $children_elements[ $e->$parent_field ][] = $e;
        }

        /*
		 * When none of the elements is top level.
		 * Assume the first one must be root of the sub elements.
		 */
        if ( empty($top_level_elements) ) {

            $first = array_slice( $elements, 0, 1 );
            $root = $first[0];

            $top_level_elements = array();
            $children_elements  = array();
            foreach ( $elements as $e) {
                if ( $root->$parent_field == $e->$parent_field )
                    $top_level_elements[] = $e;
                else
                    $children_elements[ $e->$parent_field ][] = $e;
            }
        }

        $current_index = 1;
        foreach ( $top_level_elements as $e ){
            if( $current_index > ceil($number_of_root_elements/2) ){
                $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
            }
            $current_index++;
        }

        return $output;
	}
}