/** * */ function __construct($name) { $theme =& x_getModuleManager(); $this->m_template_file = $theme->invoke('xh_templateMapping', $name); if ($this->m_template_file === NULL) { xLog::log('Template', LOG_LEVEL_ERROR, 'Template mapping does not exists', __FILE__, __LINE__); } }
/** * @param string $search_dir The relative path to search * @return array An array of strings representing modules relative paths * @static */ function findAllModules($search_dir, $suffix) { $full_search_dir = x_full_path($search_dir); $ret = array(); if ($handle = opendir($full_search_dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //search for spare file module if (preg_match("#.\\." . $suffix . "\\.php#i", $file)) { $mod_file = $search_dir . '/' . $file; $ret[] = $mod_file; } else { $mod_file = $search_dir . '/' . $file . '/' . $file . '.' . $suffix . '.php'; if (is_file($mod_file)) { $ret[] = $mod_file; } } } } closedir($handle); } else { xLog::log('Framework', LOG_LEVEL_ERROR, 'Invalid search directory for modules. Dump: ' . var_export($full_search_dir, true), __FILE__, __LINE__); } return $ret; }
/** * @access private */ function _generateOrderClause($order, &$values) { $out = ''; $first = true; foreach ($order as $clause) { if (isset($clause['column'])) { if (!$first) { $out .= ','; } else { $first = false; } if (strcasecmp($clause['direction'], 'asc') !== 0 && strcasecmp($clause['direction'], 'desc') !== 0) { xLog::log('Database', LOG_LEVEL_ERROR, 'Invalid direction for ORDER clause: "' . $clause['direction'] . '"', __FILE__, __LINE__); } else { $out .= '%s ' . $clause['direction']; $values[] = $clause['column']; } } } if (!empty($out)) { $out = ' ORDER BY ' . $out; } return $out; }
/** * */ function _getCurrent() { if (isset($_GET['p'])) { $p = $_GET['p']; $path = xPath::_parse($p); if ($path !== NULL) { $path->m_params = $_GET; unset($path->m_params['p']); return $path; } else { xLog::log('Framework', LOG_LEVEL_WARNING, 'Invalid path', __FILE__, __LINE__); } } $path = new xPath(NULL, NULL, NULL); return $path; }
/** * Render the screen log into a printable string. * * @return string * @static */ function renderFromScreen() { $output = '<div class="log">'; foreach (xLogEntry::getFromScreen() as $entry) { $output .= '<div class = "log-entry screen-log-level-' . xLog::getLevelString($entry->m_level) . '"> <ul> <li><span class="log-entry-name">ID</span>: <span class="log-entry-value">' . $entry->m_id . '</span></li> <li><span class="log-entry-name">Cathegory</span>: <span class="log-entry-value">' . $entry->m_cathegory . '</span></li> <li><span class="log-entry-name">Level</span>: <span class="log-entry-value">' . $entry->m_level . '</span></li> <li><span class="log-entry-name">Message</span>: <span class="log-entry-value">' . $entry->m_message . '</span></li> <li><span class="log-entry-name">Filename</span>: <span class="log-entry-value">' . $entry->m_filename . '</span></li> <li><span class="log-entry-name">Line</span>: <span class="log-entry-value">' . $entry->m_line . '</span></li> <li><span class="log-entry-name">Url</span>: <span class="log-entry-value">' . $entry->m_url . '</span></li> <li><span class="log-entry-name">Ip</span>: <span class="log-entry-value">' . $entry->m_ip . '</span></li> <li><span class="log-entry-name">Referer</span>: <span class="log-entry-value">' . $entry->m_referer . '</span></li> <li><span class="log-entry-name">Time</span>: <span class="log-entry-value">' . strftime('%c', $entry->m_time) . '</span></li> <li><span class="log-entry-name">Stack Trace</span>: <span class="log-entry-value"><br/>' . $entry->m_stacktrace->renderTrace() . '</span></li> </ul> </div> '; } $output .= '</div>'; return $output; }