function __construct($table, $class_name, $args = [])
 {
     $args = merge_args_defaults($args, ['ID' => "{$table}_ID", 'uid' => "{$table}_uid", 'parent' => "{$table}_parent", 'order' => "{$table}_order", 'select' => [], 'from' => $table, 'condition' => null]);
     $this->table = $table;
     $this->className = $class_name;
     $this->column_ID = $args['ID'];
     $this->column_uid = $args['uid'];
     $this->column_parent = $args['parent'];
     $this->column_order = $args['order'];
     $this->columns_select = $args['select'];
     $this->parentQuery = new DynamicQuery();
     $this->parentQuery->useTable($args['from']);
     $this->parentQuery->selectField($this->columns_select);
     if ($args['condition']) {
         $this->parentQuery->appendCondition($args['condition']);
     }
 }
/**
 * Generate a menu tree!
 * A recursive function to generate a menu tree.
 *
 * @param string $uid The menu identifier
 * @param int $level Level of the menu, used internally. Default 0.
 * @param array $args Arguments
 */
function print_menu($uid = null, $level = 0, $args = [])
{
    // Example of custom default args
    $args = merge_args_defaults($args, ['max-level' => 99, 'menu-ul-intag' => 'class="collection"']);
    // End menu if level reached
    if ($level > $args['max-level']) {
        return;
    }
    $menuEntries = get_children_menu_entries($uid);
    if (!$menuEntries) {
        return;
    }
    ?>
		<ul<?php 
    if ($level === 0) {
        echo " {$args['menu-ul-intag']}";
    }
    ?>
>
		<?php 
    foreach ($menuEntries as $menuEntry) {
        ?>
			<li class="collection-item">
				<?php 
        echo HTML::a($menuEntry->url, $menuEntry->name, $menuEntry->get('title'));
        ?>
				<?php 
        print_menu($menuEntry->uid, $level + 1, $args);
        ?>
			</li>
		<?php 
    }
    ?>
		</ul>
	<?php 
}
 /**
  * Set options.
  *
  * @param array $args Arguments.
  *	'slug' => bool
  *		If the filename have to be slugged.
  *		Default: true
  *	'override-filename' => string
  *		The filename is preserved if you don't specify it here.
  *		E.g.: 'my-pic'
  *		Default: The original filename.
  *	'pre-filename' => string
  *		Filename prefix.
  *		E.g.: date('Y-m-d-')
  *		Default: ''
  *	'post-filename' => string
  *		Filename suffix.
  *		E.g.: '_XL'
  *		Default: ''
  *	'category' => string|null
  *		Allowed MIME category/categories.
  *		Default: null (all the categories)
  *	'min-length-filename' => int
  *		Min length of the filename (no extension, no pathname).
  *		E.g.: 5
  *		Default: 2
  *	'max-length-filename' => int
  *		Max length of the filename (no extension, no pathname).
  *		E.g.: 40
  *		Default: 200
  *	'dont-overwrite' => boolean
  *		If the filename already exists can append a progressive number.
  *		E.g.: false (overwrite the file if already exists)
  *		Default: true
  */
 public function setArgs($args)
 {
     $this->args = merge_args_defaults($args, ['slug' => true, 'override-filename' => null, 'pre-filename' => '', 'post-filename' => '', 'autoincrement' => '-%d', 'category' => null, 'max-filesize' => null, 'min-length-filename' => 2, 'max-length-filename' => 200, 'dont-overwrite' => true]);
 }
 /**
  * To execute clean insert SQL queries.
  *
  * @param string $table_name Table Name without prefix
  * @param array $columns Assoc array of types ('ID' => 'null', 'name' => 's', ..)
  * @param array $rows Array of rows
  * @param array $args Extra arguments
  */
 public function insert($table_name, $columns, $rows, $args = [])
 {
     $args = merge_args_defaults($args, ['replace-into' => false]);
     force_array($rows);
     if (!@is_array($rows[0])) {
         $rows = [$rows];
         // array_columns('value col 1', '..') => array_rows( array_columns( 'value col 1', ..) )
     }
     $n_columns = count($columns);
     $n_rows = count($rows);
     $SQL_columns = '';
     $first = key($columns);
     foreach ($columns as $column => $type) {
         if ($column !== $first) {
             $SQL_columns .= ', ';
         }
         $SQL_columns .= "`{$column}`";
     }
     $insert = $args['replace-into'] ? 'REPLACE' : 'INSERT';
     $SQL = "{$insert} INTO {$this->getTable($table_name)} ({$SQL_columns}) VALUES";
     for ($i = 0; $i < $n_rows; $i++) {
         $SQL .= $i === 0 ? ' (' : ', (';
         $SQL_values = [];
         if ($n_columns != count($rows[$i])) {
             DEBUG && error(sprintf(_("Errore inserendo nella tabella <em>%s</em>. Colonne: <em>%d</em>. Colonne values[<em>%d</em>]: <em>%d</em>"), esc_html($table_name), $n_columns, $i, count($rows[$i])));
             return false;
         }
         $j = 0;
         foreach ($columns as $column => $type) {
             $SQL_values[] = $this->forceType($rows[$i][$j], $type);
             $j++;
         }
         $SQL .= implode(', ', $SQL_values) . ')';
     }
     return $this->query($SQL);
 }
function get_header($uid, $args = [])
{
    $args = merge_args_defaults($args, ['theme' => 'default']);
    switch ($args['theme']) {
        case 'default':
            enqueue_css('materialize');
            enqueue_css('materialize.icons');
            enqueue_js('jquery');
            enqueue_js('materialize');
            break;
    }
    header("Content-Type: text/html; charset=utf-8");
    ?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
    echo SITE_NAME;
    ?>
 - <?php 
    echo get_menu_entry($uid)->name;
    ?>
</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<meta property="og:title" content="<?php 
    echo get_menu_entry($uid)->name;
    ?>
" />
	<meta property="og:url" content="<?php 
    echo get_menu_entry($uid)->url;
    ?>
" />
	<meta property="og:image" content="<?php 
    echo URL . _ . IMAGES . '/fuel-300px.png';
    ?>
" />
	<meta property="og:type" content="website" />
	<link rel="icon" type="image/jpeg" href="<?php 
    echo URL . _ . IMAGES . '/fuel-64px.png';
    ?>
" /><?php 
    load_module('header');
    ?>

</head>
<!--
 This website is
  _____                                          _             _____                            _
 |  ___|  _ __    ___    ___      __ _   ___    (_)  _ __     |  ___|  _ __    ___    ___    __| |   ___    _ __ ___
 | |_    | '__|  / _ \  / _ \    / _` | / __|   | | | '_ \    | |_    | '__|  / _ \  / _ \  / _` |  / _ \  | '_ ` _ \
 |  _|   | |    |  __/ |  __/   | (_| | \__ \   | | | | | |   |  _|   | |    |  __/ |  __/ | (_| | | (_) | | | | | | |
 |_|     |_|     \___|  \___|    \__,_| |___/   |_| |_| |_|   |_|     |_|     \___|  \___|  \__,_|  \___/  |_| |_| |_|

 Learn more from:

 http://www.gnu.org

-->
<body>
<?php 
}