/** * Function used to get available templates */ function get_templates($visible = false) { $dir = STYLES_DIR; //Scaning Dir $dirs = scandir($dir); foreach ($dirs as $tpl) { if (substr($tpl, 0, 1) != '.') { $tpl_dirs[] = $tpl; } } //Now Checking for template template.xml $tpls = array(); foreach ($tpl_dirs as $tpl_dir) { if ($visible == true) { $hidden = get_hidden_templates(); if ($hidden) { if (in_array($tpl_dir, $hidden)) { continue; } } } $tpl_details = CBTemplate::get_template_details($tpl_dir); if ($tpl_details && $tpl_details['name'] != '') { $tpls[$tpl_details['name']] = $tpl_details; } } return $tpls; }
/** * Function used to get available templates */ function get_templates() { $dir = STYLES_DIR; //Scaning Dir $dirs = scandir($dir); foreach ($dirs as $tpl) { if (substr($tpl, 0, 1) != '.') { $tpl_dirs[] = $tpl; } } //Now Checking for template template.xml $tpls = array(); foreach ($tpl_dirs as $tpl_dir) { $tpl_details = CBTemplate::get_template_details($tpl_dir); if ($tpl_details && $tpl_details['name'] != '') { $tpls[$tpl_details['name']] = $tpl_details; } } return $tpls; }
/** * Function gets the list of hidden tempaltes. * $details can be set to true, if we want there details * as-well * * @author Fawaz Tahir <*****@*****.**> * @param boolean $details * @return boolean */ function get_hidden_templates($details = false) { $hidden = config('hidden_templates'); if ($hidden) { $hidden = json_decode($hidden, true); if ($details == true) { $hidden_details = array(); foreach ($hidden as $tpl_dir) { $tpl_details = CBTemplate::get_template_details($tpl_dir); if ($tpl_details && $tpl_details['name'] != '') { $hidden_details[$tpl_details['name']] = $tpl_details; } } $hidden = count($hidden_details) > 0 ? $hidden_details : false; } return $hidden; } return false; }