/** * Simple Debug info * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function systeminfo() { $objSQL = Core_Classes_coreObj::getDBO(); $objTPL = Core_Classes_coreObj::getTPL(); $objTime = Core_Classes_coreObj::getTime(); $objForm = Core_Classes_coreObj::getForm(); $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl')); // checkers // grab some info about GD if (function_exists('gd_info')) { $a = gd_info(); $gdVer = preg_replace('/[[:alpha:][:space:]()]+/', '', $a['GD Version']); } else { $gdVer = 'Not Installed.'; } $info = '<div class="alert alert-info"><strong>Important!</strong> This panel needs more updating to output more useful data that has been made avaliable during the last overhaul</div>'; $content = 'This panel gives the CMS dev team some information about your setup. ;--System Setup CMS Version: ' . CMS_VERSION . ' PHP Version: ' . PHP_VERSION . ' (' . (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on' ? 'Safe Mode Enabled' : 'Safe Mode Disabled') . ') MySQL Version: ' . mysql_get_server_info() . ' GD Version: ' . $gdVer . ' ;--CMS Setup Install Path: /' . root() . ' ' . json_encode($objSQL->fetchAll('SELECT * FROM `#__config`')) . ''; Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'System Info', 'CONTENT' => $info . $objForm->textarea('sysInfo', $content, array('style' => 'width: 99%', 'rows' => 20)), 'ICON' => 'fa-icon-user'))); }
/** * Loops through the blocks and displays them nicely using the theme template * * @version 1.0 * @since 1.0 * @author Daniel Noel-Davies * * @param array $blocks Collection of blocks * */ private function displayPortlets($blocks) { $objTPL = Core_Classes_coreObj::getTPL(); $objTPL->set_filenames(array('block_notices' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl')); $rowCount = 12; foreach ($blocks as $title => $block) { $block['COL'] = (int) doArgs('COL', 12, $block); $objTPL->assign_block_vars('block', array('TITLE' => $title, 'CONTENT' => dump($rowCount, 'RowCount') . dump($block, 'block'), 'ICON' => 'icon-' . doArgs('ICON', null, $block))); // If there are no blocks in the row, Start new row if ($rowCount === 12) { $objTPL->assign_block_vars('block.start_row', array()); // If there is no space for the current block, end the current div above everything, and start a new one } else { if ($rowCount - $block['COL'] < 0) { $objTPL->assign_block_vars('block.start_row', array()); $objTPL->assign_block_vars('block.pre_end_row', array()); } } // If, after everything, we are at 0, end the current block, and reset the row count $rowCount -= $block['COL']; if ($rowCount <= 0) { $objTPL->assign_block_vars('block.end_row', array()); $rowCount = 12; } $objTPL->assign_block_vars('block.' . doArgs('COL', '12', $block) / 4 . 'col', array()); $objTPL->assign_vars(array('BLOCKS' => $objTPL->get_html('block_notices'))); } }
/** * Outputs a table with the currently detected set of modules on * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function modules() { $objSQL = Core_Classes_coreObj::getDBO(); $objTPL = Core_Classes_coreObj::getTPL(); $objModule = Core_Classes_coreObj::getModule(); $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'panel' => cmsROOT . 'modules/core/views/admin/modules/default/module_list.tpl')); $files = glob(sprintf('%smodules/*', cmsROOT)); foreach ($files as $file) { $moduleName = str_replace('modules/', '', $file); // Determine the status of the module if (parent::moduleExists($moduleName) === false) { continue; } $query = $objSQL->queryBuilder()->select('*')->from('#__modules')->where('name', '=', $moduleName)->build(); $row = $objSQL->fetchLine($query); $moduleInstalled = parent::moduleInstalled($moduleName); if (empty($row) || $moduleInstalled === false) { $details = $objModule->getModuleDetails($moduleName); if (!empty($details)) { $version = $details['version']; $hash = $details['hash']; } } $objTPL->assign_block_vars('module', array('NAME' => $moduleName, 'VERSION' => $version, 'HASH' => $hash, 'STATUS' => $moduleInstalled === false ? 'Not Installed' : 'Installed', 'STATUS_ICON' => $moduleInstalled === false ? 'default' : 'success')); } $objTPL->parse('panel', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Module List', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'icon-th-list'))); }
/** * Add a new user to the system * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function add() { $objSQL = Core_Classes_coreObj::getDBO(); $objTPL = Core_Classes_coreObj::getTPL(); $objTime = Core_Classes_coreObj::getTime(); Core_Classes_coreObj::getPage()->addBreadcrumbs(array(array('url' => doArgs('REQUEST_URI', '', $_SERVER), 'name' => 'Add User'))); $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'panel' => cmsROOT . 'modules/core/views/admin/users/add.tpl')); $objTPL->parse('panel', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Add User', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'faicon-user'))); }
/** * Generates a form for the site configuration * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function siteConfig() { Core_Classes_coreObj::getPage()->addBreadcrumbs(array(array('url' => doArgs('REQUEST_URI', '', $_SERVER), 'name' => 'Site Config'))); $objForm = Core_Classes_coreObj::getForm(); $objTPL = Core_Classes_coreObj::getTPL(); $yn = array(1 => langVar('L_YES'), 0 => langVar('L_NO')); $fields = array(langVar('L_SITE_CONFIG') => '_header_', langVar('L_SITE_TITLE') => $objForm->inputbox('title', 'text', $this->config('site', 'title')), langVar('L_SITE_SLOGAN') => $objForm->inputbox('slogan', 'text', $this->config('site', 'slogan')), langVar('L_ADMIN_EMAIL') => $objForm->inputbox('admin_email', 'text', $this->config('site', 'admin_email')), langVar('L_GANALYTICS') => $objForm->inputbox('google_analytics', 'input', $this->config('site', 'google_analytics')), langVar('L_CUSTOMIZE') => '_header_', langVar('L_THEME_OVERRIDE') => $objForm->radio('theme_override', $yn, $this->config('site', 'theme_override')), langVar('L_SITE_TZ') => $timezone, langVar('L_DST') => $objForm->radio('dst', $yn, $this->config('time', 'dst')), langVar('L_DEF_DATE_FORMAT') => $objForm->inputbox('default_format', 'input', $this->config('time', 'default_format'))); $form = $objForm->outputForm(array('FORM_START' => $objForm->start('panel', array('method' => 'POST', 'action' => $saveUrl, 'class' => 'form-horizontal')), 'FORM_END' => $objForm->finish(), 'FORM_TITLE' => $mod_name, 'FORM_SUBMIT' => $objForm->button('submit', 'Submit', array('class' => 'btn-primary')), 'FORM_RESET' => $objForm->button('reset', 'Reset'), 'HIDDEN' => $objForm->inputbox('sessid', 'hidden', $sessid) . $objForm->inputbox('id', 'hidden', $uid)), array('field' => $fields, 'desc' => array(langVar('L_INDEX_MODULE') => langVar('L_DESC_IMODULE'), langVar('L_SITE_TZ') => langVar('L_DESC_SITE_TZ'), langVar('L_DEF_DATE_FORMAT') => langVar('L_DESC_DEF_DATE'), langVar('L_DEF_THEME') => langVar('L_DESC_DEF_THEME'), langVar('L_THEME_OVERRIDE') => langVar('L_DESC_THEME_OVERRIDE'), langVar('L_ALLOW_REGISTER') => langVar('L_DESC_ALLOW_REGISTER'), langVar('L_EMAIL_ACTIVATE') => langVar('L_DESC_EMAIL_ACTIVATE'), langVar('L_MAX_LOGIN_TRIES') => langVar('L_DESC_MAX_LOGIN'), langVar('L_REMME') => langVar('L_DESC_REMME'), langVar('L_GANALYTICS') => langVar('L_DESC_GANALYTICS')), 'errors' => $_SESSION['site']['panel']['error']), array('header' => '<h4>%s</h4>', 'dedicatedHeader' => true, 'parseDesc' => true)); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Site Configuration', 'CONTENT' => $form, 'ICON' => 'fa-icon-user'))); }
/** * Outputs a table with currently detected themes in * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function themes() { $objForm = Core_Classes_coreObj::getForm(); $objTPL = Core_Classes_coreObj::getTPL(); $objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl', 'table' => cmsROOT . 'modules/core/views/admin/themes/manageTable.tpl')); $dir = cmsROOT . 'themes'; $tpls = getFiles($dir); //echo dump($tpls); foreach ($tpls as $tpl) { if ($tpl['type'] !== 'dir') { continue; } $tplName = secureMe($tpl['name'], 'alphanum'); $details = $this->getDetails($tplName); //echo dump($details, $tplName); $objTPL->assign_block_vars('theme', array('NAME' => doArgs('name', 'N/A', $details), 'VERSION' => doArgs('version', '0.0', $details), 'ENABLED' => 'true', 'COUNT' => '9001', 'MODE' => doArgs('mode', 'N/A', $details), 'AUTHOR' => doArgs('author', 'N/A', $details))); } $objTPL->parse('table', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Theme Management', 'CONTENT' => $objTPL->get_html('table', false), 'ICON' => 'fa-icon-user'))); }
public function block_login($block) { $objTPL = Core_Classes_coreObj::getTPL(); $objForm = Core_Classes_coreObj::getForm(); $objSession = Core_Classes_coreObj::getSession(); $objPage = Core_Classes_coreObj::getPage(); if (Core_Classes_User::$IS_ONLINE) { $objPage->redirect('/' . root()); } $objTPL->set_filenames(array('block_login' => cmsROOT . 'modules/core/views/module/login_form/block.tpl')); $form = array('FORM_START' => $objForm->start('login', array('method' => 'POST', 'action' => '/' . root() . 'login?')), 'FORM_END' => $objForm->finish(), 'HIDDEN' => $objForm->inputbox('hash', 'hidden', $objSession->getFormToken(true)), 'L_USERNAME' => langVar('L_USERNAME'), 'F_USERNAME' => $objForm->inputbox('username', 'text', '', array('class' => 'icon username', 'required' => true)), 'L_PASSWORD' => langVar('L_PASSWORD'), 'F_PASSWORD' => $objForm->inputbox('password', 'password', '', array('class' => 'icon password', 'required' => true)), 'L_REMME' => langVar('L_REMME'), 'F_REMME' => $objForm->select('remember', array('0' => 'No Thanks', '1' => 'Forever'), array('selected' => 0)), 'SUBMIT' => $objForm->button('submit', 'Login', array('class' => 'btn btn-success'))); $objTPL->reset_block_vars('login'); $objTPL->assign_block_vars('login', $form); $objTPL->assign_vars(array('TITLE' => $block['title'])); if (isset($_SESSION['login']['errors']) && count($_SESSION['login']['errors'])) { foreach ($_SESSION['login']['errors'] as $error) { $objTPL->assign_block_vars('login.errors', array('ERROR' => $error)); } unset($_SESSION['login']); } return $objTPL->get_html('block_login'); }
/** * Retrieves all the used template files * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @param bool $output If True, The function will output the HTML * * @return array */ public function getTemplateInfo($output = false) { if ($output !== true) { return ''; } $output = ''; $objTPL = Core_Classes_coreObj::getTPL(); $files = $objTPL->files; if (count($objTPL->files)) { $output .= '<h4>Template Files</h4>'; $output .= '<table class="table table-bordered">'; $output .= sprintf('<tr><th>%s</th>', 'TPL Handle'); $output .= sprintf('<th>%s</th></tr>', 'Path'); foreach ($files as $handle => $file) { $output .= sprintf('<tr><td>%s</td>', $handle); $output .= sprintf('<td>%s</td></tr>', $file); } $output .= '</table>'; $output .= '<h4>Template Variables</h4>'; $output .= dump($objTPL->_tpldata); } return array('count' => count($objTPL->files), 'content' => $output); }
/** * Shows a message and then exit the current page with a footer. * * @version 2.0 * @since 0.6.0 */ function msgDie($msg_type, $message, $line = null, $file = null, $query = null, $footer = true) { $objTPL = Core_Classes_coreObj::getTPL(); $objPage = Core_Classes_coreObj::getPage(); //if(!is_object($objTPL) || !is_object($objPage)){ echo $message; exit; } $objTPL->set_filenames(array('__msgBody' => cmsROOT . 'modules/core/views/module/message/default.tpl')); $query = !is_empty($query) ? $query : null; $line = !is_empty($line) ? $line : null; $file = !is_empty($file) ? $file : null; switch (strtolower($msg_type)) { case 'fail': $img = '/' . root() . 'images/fail.png'; $type = 'error'; break; case 'ok': $img = '/' . root() . 'images/ok.png'; $type = 'status'; break; case 'info': $img = '/' . root() . 'images/info.png'; $type = 'warning'; break; default: $img = null; break; } $objTPL->assign_vars(array('L_MSG_TYPE' => langVar('MSG_' . strtoupper($msg_type)), 'L_MSG' => $message, 'QUERY' => $query, 'LINE' => 'Line: ' . $line, 'FILE' => 'File: ' . $file, 'IMG' => isset($img) && !is_empty($img) ? '<img src="' . $img . '" style="height: 48px; width: 48px;">' : '', 'ALIGN' => 'center', 'TYPE' => $type)); $gen_time = '0'; $objTPL->parse('__msgBody'); if ($footer) { $objPage->showFooter(); } exit; }
/** * Outputs a block with content in for the ACP * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public static function setupBlock($handle, $options = array()) { $options = array('cols' => doArgs('cols', 3, $options), 'vars' => isset($options['vars']) && is_array($options['vars']) ? $options['vars'] : array(), 'custom' => isset($options['custom']) && is_array($options['custom']) ? $options['custom'] : array(), 'custom_html' => isset($options['custom_html']) && is_array($options['custom_html']) ? $options['custom_html'] : array()); if (is_empty($options['vars'])) { trigger_error('No vars passed to setupBlock()'); return; } if (!in_array($options['cols'], array(1, 2, 3))) { trigger_error('Columns option needs to be 1 2 or 3'); return; } $objTPL = Core_Classes_coreObj::getTPL(); $objTPL->set_filenames(array($handle => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl')); $objTPL->assign_block_vars('block', $options['vars']); $objTPL->assign_block_vars('block.start_row', array()); $objTPL->assign_block_vars('block.' . $options['cols'] . 'col', array()); if (!is_empty($options['custom'])) { $objTPL->assign_block_vars('block.custom', $options['custom']); } if (!is_empty($options['custom_html'])) { $objTPL->assign_block_vars('block.custom_html', $options['custom_html']); } $objTPL->assign_block_vars('block.end_row', array()); $objTPL->parse($handle, false); }
<?php /*======================================================================*\ || Cybershade CMS - Your CMS, Your Way || \*======================================================================*/ define('INDEX_CHECK', true); define('cmsDEBUG', true); $GET = $_GET; require_once 'core/core.php'; $objRoute = Core_Classes_coreObj::getRoute(); $objPage = Core_Classes_coreObj::getPage(); $objTPL = Core_Classes_coreObj::getTPL(); $objAdmin = Core_Classes_coreObj::getAdminCP('', $GET); $objUser = Core_Classes_coreObj::getUser(); $objRoute->modifyGET($GET); if (!Core_Classes_User::$IS_ONLINE || !Core_Classes_User::$IS_ADMIN) { // Need to sort out login // $objRoute->throwHTTP(404); $objPage->redirect('/' . root() . 'login'); exit; } $objPage->setTheme('perfectum-mootools'); $objPage->addBreadcrumbs(array(array('url' => '/' . root() . $objAdmin->mode . '/', 'name' => ucwords($objAdmin->mode) . ' Control Panel'))); $objPage->setTitle('Cybershade CMS Administration Panel'); // grab the nav and throw the baSic tpl setups together $objAdmin->getNav(); $objPage->tplGlobals(); // sort the route out, see what we need to do $objAdmin->invokeRoute(); // and then output..something $objPage->showHeader();
/** * Tests to see if we have a body handle in the template system, if so output it * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge */ public function output() { $objTPL = Core_Classes_coreObj::getTPL(); $page = Core_Classes_coreObj::getPage()->getVar('contents'); if (!$objTPL->isHandle('body')) { if ($page === null) { msgDie('FAIL', 'No output received from module.'); } else { echo $page; } } else { if (!is_empty($page)) { echo $page; } echo $objTPL->get_html('body'); } }
/** * Returns the html for the pagination * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @param array $options * * @return int */ public function getPagination($options = array()) { $options = array('url' => doArgs('url', '', $options), 'controls' => doArgs('controls', false, $options), 'type' => doArgs('type', 'pagination-mini', $options), 'showOne' => doArgs('showOne', false, $options)); $objTPL = Core_Classes_coreObj::getTPL(); $objUser = Core_Classes_coreObj::getUser(); // if we have 1 or less pages, then unless we specifically want to see it, hide the pagination if ($this->getTotalPages() <= 1) { if ($options['showOne'] === false) { return ''; } } // generate the pagination handle - each one has to be diff, to support > 1 on a page $handle = 'pagination_' . randCode(6); $objTPL->set_filenames(array($handle => cmsROOT . 'modules/core/views/markup.tpl')); // figure out which one we want to use $switch = IS_ONLINE ? $objUser->get('paginationStyle') : '1'; if (!method_exists($this, 'paginationStyle' . $switch)) { $switch = '1'; } $pages = $this->{'paginationStyle' . $switch}($options['controls']); $pages = isset($pages) ? $pages : array(); // setup the output $objTPL->assign_block_vars('pagination', array('TYPE' => $options['type'])); foreach ($pages as $page) { $objTPL->assign_block_vars('pagination.page', array('NUM' => doArgs('label', doArgs('count', '0', $page), $page), 'STATE' => doArgs('state', '', $page))); if (doArgs('url', true, $page)) { $objTPL->assign_block_vars('pagination.page.url', array('URL' => doArgs('url', true, $page) ? $this->url . $this->instance . '=' . doArgs('count', '0', $page) : '')); } else { $objTPL->assign_block_vars('pagination.page.span', array()); } } // and output $objTPL->parse($handle, false); return $objTPL->get_html($handle); }
public function tplGlobals() { $objUser = Core_Classes_coreObj::getUser(); $tplGlobals = array('ROOT' => root(), 'THEME_ROOT' => root() . self::$THEME_ROOT, 'SITE_TITLE' => $this->config('site', 'title'), 'USERNAME' => $objUser->grab('username'), 'U_UCP' => '/' . root() . 'user/', 'L_UCP' => langVar('L_UCP')); if (!Core_Classes_User::$IS_ONLINE) { $tplGlobals += array('U_LOGIN' => '/' . root() . 'login', 'L_LOGIN' => 'Login'); } else { $tplGlobals += array('U_LOGIN' => '/' . root() . 'logout?check=' . $objUser->grab('usercode'), 'L_LOGIN' => 'Logout'); } $moreTPL = Core_Classes_coreObj::getPlugins()->hook('CMS_PAGE_TPL_GLOBALS'); if (is_array($moreTPL) && count($moreTPL) > 1) { foreach ($moreTPL as $vars) { $tplGlobals = array_merge($tplGlobals, $vars); } } Core_Classes_coreObj::getTPL()->assign_vars($tplGlobals); }
/** * Editor for the menu system * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function edit($args = array()) { $objTPL = Core_Classes_coreObj::getTPL(); $objSQL = Core_Classes_coreObj::getDBO(); $objPage = Core_Classes_coreObj::getPage(); // Check we have the menu name if (!is_array($args) || !is_string($args[1]) || strlen($args[1]) == 0) { // error trigger_error('Error: Could not get menu name.'); $this->menus(); return; } /** Menu JS **/ $objPage->addCSSFile(array('href' => '/' . root() . 'modules/core/assets/styles/admin/menus/Tree.css', 'type' => 'text/css')); $objPage->addCSSFile(array('href' => '/' . root() . 'modules/core/assets/styles/admin/menus/Collapse.css', 'type' => 'text/css')); $objPage->addJSFile(array('src' => '/' . root() . 'modules/core/assets/javascript/admin/menus/Tree.js'), 'footer'); $objPage->addJSFile(array('src' => '/' . root() . 'modules/core/assets/javascript/admin/menus/custom.js'), 'footer'); $menuName = $args[1]; $objTPL->set_filenames(array('panel' => cmsROOT . 'modules/core/views/admin/menus/menu_link_list.tpl')); $queryList = $objSQL->queryBuilder()->select('*')->from('#__menus')->where('menu_name', '=', $menuName)->orderBy('`parent_id`, `order`', 'ASC'); $links = $objSQL->fetchAll($queryList->build()); if (!is_array($links)) { trigger_error('Error: Menu does not exist.'); $this->menus(); return false; } $args = array('title' => 'link_title', 'id' => 'id', 'parent' => 'parent_id'); $tree = $this->generateTree($links, $args); $objTPL->assign_var('tree_menu', $tree); $objTPL->parse('panel', false); Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'Edit Menu - <strong>' . secureMe($menuName) . '</strong>', 'CONTENT' => $objTPL->get_html('panel', false), 'ICON' => 'icon-th-list'), 'custom' => array('ICON' => 'icon-save', 'URL' => '#', 'TITLE' => 'Save', 'LINK' => '', 'CLASS' => '', 'EXTRA' => 'data-toggle="tooltip" data-placement="top"'))); }
public function outputForm($vars, $elements, $options = array()) { //make sure we have something to use before continuing if (is_empty($elements)) { $this->setError('Nothing to output'); return false; } if (!isset($elements['field']) || is_empty($elements['field'])) { $this->setError('Fields are blank or undetectable, make sure they are set using \'field\' key.'); return false; } //init the template, give it a rand id to stop it clashing with anything else $randID = inBetween('name="', '"', $vars['FORM_START']); $objTPL = Core_Classes_coreObj::getTPL(); $objTPL->set_filenames(array('form_body_' . $randID => 'modules/core/views/outputForm.tpl')); if (!doArgs('border', true, $options)) { $vars['EXTRA'] = ' class="noBorder"'; } if (doArgs('id', false, $options)) { $vars['SECTION_ID'] = doArgs('id', null, $options); } $dediHeader = doArgs('dedicatedHeader', false, $options); $objTPL->assign_vars($vars); $objTPL->reset_block_vars('form_error'); if (isset($elements['errors']) && !is_empty($elements['errors'])) { $objTPL->assign_block_vars('form_error', array('ERROR_MSG' => implode('<br />', $elements['errors']))); } $count = 0; $objTPL->reset_block_vars('field'); //loop thru each element foreach ($elements['field'] as $label => $field) { if (is_empty($field)) { continue; } $formVars = array(); //grab the description before we play with the $label $desc = $elements['desc'][$label]; //upper care the words $label = ucwords($label); //if its a header, set it as one with a hr under if ($field == '_header_') { $label = sprintf(doArgs('header', '%s', $options), $label); } $header = $field == '_header_' ? true : false; $objTPL->assign_block_vars('_form_row', array()); if ($dediHeader && $header) { $objTPL->assign_block_vars('_form_row._header', array('L_LABEL' => $label)); } else { // assign some vars to the template $objTPL->assign_block_vars('_form_row._field', array('F_ELEMENT' => $header ? null : $field, 'F_INFO' => doArgs('parseDesc', false, $options) ? contentParse($desc) : $desc, 'CLASS' => $header ? ' title' : ($count++ % 2 ? ' row_color2' : ' row_color1'), 'L_LABEL' => $label, 'L_LABELFOR' => inBetween('name="', '"', $field))); // if this isnt a 'header' then output the label if (!$header) { $objTPL->assign_block_vars('_form_row._field._label', array()); } // if we have a description, lets output it with the label if (!is_empty($desc)) { $objTPL->assign_block_vars('_form_row._field._desc', array()); } // see if we need to prepend or append anything to the field $pre = inBetween('data-prepend="', '"', $field); $app = inBetween('data-append="', '"', $field); if (!is_empty($pre)) { $objTPL->assign_block_vars('_form_row._field._prepend', array('ADDON' => $pre)); } else { if (!is_empty($app)) { $objTPL->assign_block_vars('_form_row._field._append', array('ADDON' => $app)); } else { $objTPL->assign_block_vars('_form_row._field._normal', array()); } } } } //return the html all nicely parsed etc return $objTPL->get_html('form_body_' . $randID); }