本文整理汇总了PHP中JError::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::getErrors方法的具体用法?PHP JError::getErrors怎么用?PHP JError::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::getErrors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
function uninstall()
{
if (count(JError::getErrors()) > 0) {
echo "Error condition - Uninstallation not successfull! You have to manually remove com_jotcache from '.._extensions' table as well as to drop '.._jotcache' and '.._jotcache_exclude' tables";
} else {
echo "Uninstallation successfull!";
}
}
示例2: testGetErrors
/**
* Test JError::getErrors
*
* @return void
*/
public function testGetErrors()
{
JErrorInspector::manipulateStack(array('value1', 'value2', 'value3'));
$this->assertThat(
JError::getErrors(),
$this->equalTo(array('value1', 'value2', 'value3')),
'Somehow a basic getter did not manage to return the static value'
);
JErrorInspector::manipulateStack(array());
}
示例3: display
function display($tpl = null)
{
// Initialize variables
$document =& JFactory::getDocument();
$user =& JFactory::getUser();
$app =& JFactory::getApplication();
$errors =& JError::getErrors();
$titulo = JText::_('.~ JOOPOA - Usuários ~.');
// Set page title
$document->setTitle($title);
$this->assign('titulo', $titulo);
parent::display($tpl);
}
示例4: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
// Initialize variables
$document =& JFactory::getDocument();
$user =& JFactory::getUser();
$app =& JFactory::getApplication();
$titulo = JText::_('.~ JOOPOA - Listar ~.');
// Set page title
$document->setTitle($title);
$errors =& JError::getErrors();
$this->assign('sobre', "Informações adicionais sobre o JOOPOA!!!");
$this->assign('titulo', $titulo);
parent::display($tpl);
}
示例5: display
function display($tpl = null)
{
// Initialize variables
$document =& JFactory::getDocument();
$user =& JFactory::getUser();
$app =& JFactory::getApplication();
$errors =& JError::getErrors();
$titulo = JText::_('.~ JOOPOA - WS - Sobre ~.');
$params =& JComponentHelper::getParams('com_joopoa');
// Set page title
$document->setTitle($title);
$this->assign('sobre', "Informações adicionais sobre o JOOPOA - WS!!!");
$this->assign('titulo', $titulo);
$this->assign('paramsTable', $params->render());
parent::display($tpl);
}
示例6: save
public function save($coupon = null)
{
global $aecConfig;
$this->confirmed = 1;
$this->loadPlanObject();
$add =& $this;
$exchange = $silent = null;
$this->triggerMIs('before_invoice_confirm', $exchange, $add, $silent);
if (empty($this->userid)) {
if (!empty($aecConfig->cfg['skip_registration'])) {
if (!$this->reCaptchaCheck()) {
return false;
}
}
$dbtmpl = new configTemplate();
$dbtmpl->loadDefault();
if (!empty($dbtmpl->settings['tos'])) {
$tos = aecGetParam('tos', 0, true, array('bool'));
if (!$tos) {
$this->confirmed = 0;
return $this->confirm();
}
}
if (!empty($this->plan)) {
if (!isset($this->plan->params['override_activation'])) {
$this->plan->params['override_activation'] = false;
}
if (!isset($this->plan->params['override_regmail'])) {
$this->plan->params['override_regmail'] = false;
}
$this->userid = aecRegistration::saveUserRegistration($this->passthrough, false, $this->plan->params['override_activation'], $this->plan->params['override_regmail']);
} else {
$this->userid = aecRegistration::saveUserRegistration($this->passthrough);
}
if (!$this->userid) {
$errors = JError::getErrors();
aecErrorAlert(JText::_('COM_USERS_REGISTRATION_SAVE_FAILED'));
}
}
$this->loadMetaUser(true);
$this->metaUser->setTempAuth();
if (!empty($this->plan)) {
if ($this->verifyMIForms($this->plan) === false) {
$this->confirmed = 0;
return $this->confirm();
}
} elseif (!empty($this->cart)) {
$check = true;
foreach ($this->cart as $ci) {
if ($this->verifyMIForms($ci['obj']) === false) {
$check = false;
}
}
if (!$check) {
$this->confirmed = 0;
return $this->confirm();
}
}
return $this->checkout(0, null, $coupon);
}
示例7: display
//.........这里部分代码省略.........
$model->_lastTaskData = JRequest::getVar('taskData', '');
// TODO: query table/forms to find out which blocks are releated to the block that has updated itself
$model->_updateBlocks = JRequest::getVar('fbUpdateBlocks', array());
$model->loadTables();
$package =& $model->getPackage();
$usedForms = array();
if ($package->tables != '') {
$tableids = explode(",", $package->tables);
foreach ($tableids as $i) {
if ($i === '') {
continue;
}
//in PHP5 objects are assigned by reference as default -
//cloning object doesnt deep clone other oject references either??
//this copy method might be intensive
$tableView = clone $this->_tableView;
$tableView->setId($i);
$tableView->_isMambot = true;
$tableModel =& $tableView->getModel();
$tableModel->setId($i);
$tableModel->_packageId = $this->_id;
$tableModel->_postMethod = 'ajax';
$table =& $tableModel->getTable();
$this->blocks[$table->label] = $tableView->display();
$table = $tableModel->getTable();
$formModel =& $tableModel->getForm();
$formModel->_editable = 1;
$formView = clone $this->_formView;
//used to buffer output
$formView->_isMambot = true;
$formView->setId($table->form_id);
$formModel->_postMethod = 'ajax';
$formModel->_packageId = $this->_id;
$usedForms[] = $formModel->_id;
$formView->setModel($formModel, true);
$this->blocks['form_' . $formModel->_id] = $formView->display();
//creating a read only view
$formModel->_editable = 0;
$formView->setModel($formModel, true);
$orgiView = JRequest::getVar('view', 'form');
$view = JRequest::setVar('view', 'details');
$this->blocks[$table->label . ' details'] = $formView->display();
JRequest::setVar('view', $orgiView);
}
}
// see if we have any forms that dont record to the database that need to be added to blocks[]
// can occur when redering a form in a module with use ajax turned on
if ($package->forms != '') {
$formids = explode(",", $package->forms);
foreach ($formids as $fid) {
if (!array_key_exists('form_' . $fid, $this->blocks)) {
$formModel->_editable = 1;
$formView = clone $this->_formView;
//used to buffer output
$formView->_isMambot = true;
$formView->setId($fid);
$formModel->_postMethod = 'ajax';
$formModel->_packageId = $this->_id;
$usedForms[] = $formModel->_id;
$formView->setModel($formModel, true);
$this->blocks['form_' . $formModel->_id] = $formView->display();
}
}
}
$model->render();
$this->_basePath = COM_FABRIK_FRONTEND . DS . 'views';
$tmpl = JRequest::getVar('layout', 'default');
//$this->blocks = $model->_blocks;
$this->_setPath('template', $this->_basePath . DS . 'package' . DS . 'tmpl' . DS . $tmpl);
if (!isset($package->template)) {
$package->template = 'default';
$tmpl = JRequest::getVar('layout', $package->template);
} else {
//set by table module in ajax mode
$tmpl = $package->template;
}
$this->_includeCSS($tmpl);
$this->_basePath = COM_FABRIK_FRONTEND . DS . 'views';
$this->_setPath('template', $this->_basePath . DS . 'package' . DS . 'tmpl' . DS . $tmpl);
$liveTmplPath = JURI::root() . '/components/com_fabrik/views/package/tmpl/' . $tmpl . '/';
FabrikHelperHTML::mootools();
FabrikHelperHTML::mocha();
// check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE . DS . "components" . DS . "com_fabrik" . DS . "views" . DS . "package" . DS . "tmpl" . DS . $tmpl . DS . "javascript.js";
if (file_exists($aJsPath)) {
FabrikHelperHTML::script("javascript.js", 'components/com_fabrik/views/package/tmpl/' . $tmpl . '/', true);
}
//ensure we don't have an incorrect version of mootools loaded
FabrikHelperHTML::cleanMootools();
if ($this->_isMambot) {
$res = $this->loadTemplate();
if (JError::isError($res)) {
print_r(JError::getErrors());
} else {
return $res;
}
} else {
parent::display();
}
}
示例8: doCopy
/**
* copy a table
*/
public function doCopy()
{
// Check for request forgeries
JRequest::checkToken() or die('Invalid Token');
$this->setRedirect('index.php?option=com_fabrik&c=table');
$cid = JRequest::getVar('cid', null, 'post', 'array');
$model =& JModel::getInstance('table', 'FabrikModel');
$n = count($cid);
if ($n > 0) {
foreach ($cid as $id) {
$model->setId($id);
$table =& $model->getTable();
$ok = $model->copy();
if (JError::isError($ok)) {
JRequest::set($origRequest);
return JError::getErrors();
}
}
} else {
return JError::raiseWarning(500, JText::_('NO ITEMS SELECTED'));
}
JRequest::set($origRequest);
$this->setMessage(JText::sprintf('ITEMS COPIED', $n));
}
示例9: install
/**
* Install dependency package.
*
* @return string
*/
public function install()
{
// Get dependency declaration
$extension = (object) $_GET;
// Get product edition
$edition = $this->getEdition();
// Get Joomla version
$JVersion = new JVersion();
// Get download link
$url = $this->getLink($extension, $JVersion);
// Finalize upload
if (isset($_FILES['package'])) {
if (!JFile::upload($_FILES['package']['tmp_name'], $this->config->get('tmp_path') . '/' . $_FILES['package']['name'])) {
throw new Exception('FAIL:' . JText::_('JSN_EXTFW_INSTALLER_PACKAGE_SAVING_FAILED') . '|' . $url);
}
$this->input->set('package', $_FILES['package']['name']);
}
if ($this->input->getString('package')) {
// Initialize dependency package path
$file = $this->config->get('tmp_path') . '/' . $this->input->getString('package');
$path = substr($file, 0, -4);
if (!is_file($file)) {
// Check temporary directory existen
if (!$this->config->get('ftp_enable') and (!is_dir($this->config->get('tmp_path')) or !is_writable($this->config->get('tmp_path')))) {
throw new Exception('FAIL:' . JText::_('JSN_EXTFW_INSTALLER_TEMPORARY_DIRECTORY_NOT_WRITABLE') . '|' . $url);
} else {
throw new Exception('FAIL:' . JText::sprintf('JSN_EXTFW_INSTALLER_PACKAGE_NOT_FOUND', $this->input->getString('package')) . '|' . $url);
}
}
$extension->source = $path;
// Extract dependency package
if (!JArchive::extract($file, $path)) {
throw new Exception('FAIL:' . JText::_('JSN_EXTFW_INSTALLER_EXTRACT_PACKAGE_FAIL') . '|' . $url);
}
// Switch off debug mode to catch JInstaller error message manually
$config = JFactory::getConfig();
$debug = $config->get('debug');
$config->set('debug', version_compare($JVersion->RELEASE, '3.0', '<') ? false : true);
// Get JSN Installer
require_once JPATH_COMPONENT_ADMINISTRATOR . '/subinstall.php';
$installer = $this->input->getCmd('option') . 'InstallerScript';
$installer = new $installer();
try {
$installer->installExtension($extension);
} catch (Exception $e) {
throw $e;
}
// Clean-up temporary folder and file
JFolder::delete($extension->source);
JFile::delete("{$extension->source}.zip");
// Restore debug settings
$config->set('debug', $debug);
// Check if installation success
$messages = JFactory::getApplication()->getMessageQueue();
if (class_exists('JError')) {
$messages = array_merge(JError::getErrors(), $messages);
}
foreach ($messages as $message) {
if (is_array($message) and @$message['type'] == 'error' or is_object($message) and (!method_exists($message, 'get') or $message->get('level') == E_ERROR)) {
$errors[is_array($message) ? $message['message'] : $message->getMessage()] = 1;
}
}
if (@count($errors)) {
throw new Exception('<ul><li>' . implode('</li><li>', array_keys($errors)) . '</li></ul>');
}
} else {
throw new Exception('FAIL:' . JText::_('JSN_EXTFW_INSTALLER_MISSING_PACKAGE_NAME') . '|' . $url);
}
return 'SUCCESS';
}
示例10: login
function login($username, $password) {
$app = JFactory::getApplication();
// Populate the data array:
$data = array();
$data['return'] = base64_decode(JRequest::getVar('return', '', 'POST', 'BASE64'));
// Set the return URL if empty.
if (empty($data['return'])) {
$data['return'] = 'index.php?option=com_users&view=profile';
}
// Get the log in options.
$options = array();
$options['remember'] = JRequest::getBool('remember', false);
$options['return'] = $data['return'];
// Get the log in credentials.
$credentials = array();
$credentials['username'] = $username;
$credentials['password'] = $password;
// Perform the log in.
$error = $app->login($credentials, $options);
if (JOOMLA16 || JOOMLA17) {
$plugin = JPluginHelper::getPlugin('user', 'oseuser');
if (!empty($plugin)) {
$pluginParams = oseJSON::decode($plugin->params);
$loginRedirect = $pluginParams->loginRedirect;
$redmenuid = $pluginParams->redmenuid;
$sefroutemethod = $pluginParams->sefroutemethod;
} else {
$loginRedirect = false;
}
} else {
$plugin = JPluginHelper::getPlugin('user', 'oseuser');
if (!empty($plugin)) {
$pluginParams = new JParameter($plugin->params);
$loginRedirect = $pluginParams->get('loginRedirect');
$redmenuid = $pluginParams->get('redmenuid');
$sefroutemethod = $pluginParams->get('sefroutemethod');
} else {
$loginRedirect = false;
}
}
$user = JFactory::getUser();
$db = JFactory::getDBO();
$query = " SELECT a.menuid" . " FROM `#__menu` as m" . " LEFT JOIN `#__osemsc_acl` as a ON a.menuid = m.id" . " LEFT JOIN `#__osemsc_member` as b ON b.msc_id = a.id"
. " WHERE b.member_id={$user->id} AND b.status = 1 ORDER BY a.menuid DESC LIMIT 1";
$db->setQuery($query);
$menu = $db->loadObject();
if (!empty($menu)) {
$redmenuid = $menu->menuid;
}
if ($loginRedirect && !empty($redmenuid)) {
$db = JFactory::getDBO();
$query = "SELECT * FROM `#__menu` WHERE `id` = " . (int) $redmenuid;
$db->setQuery($query);
$menu = $db->loadObject();
switch ($sefroutemethod) {
default:
case 0:
$return = ($menu->link == 'index.php?Itemid=') ? 'index.php' : $menu->link . "&Itemid=" . $menu->id;
break;
case 1:
$return = ($menu->link == 'index.php?Itemid=') ? JRoute::_(JURI::root() . 'index.php') : JRoute::_($menu->link . "&Itemid=" . $menu->id);
break;
case 2:
$return = JRoute::_($menu->alias);
break;
}
} else {
$session = JFactory::getSession();
$return = $session->get('oseReturnUrl', base64_encode(JURI::root() . 'index.php?option=com_osemsc&view=login'));
$return = base64_decode($return);
}
$result = array();
// Check if the log in succeeded.
$user_id = intval(JUserHelper::getUserId($username));
$user = JFactory::getUser($user_id);
if ($user->get('block')) {
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('LOGIN_DENIED_YOUR_ACCOUNT_HAS_EITHER_BEEN_BLOCKED_OR_YOU_HAVE_NOT_ACTIVATED_IT_YET');
$result['returnUrl'] = $return;
return $result;
}
if ($error) {
if (!JError::isError($error)) {
$result['success'] = true;
$result['returnUrl'] = $return;
return $result;
} else {
$errors = JError::getErrors();
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('PLEASE_MAKE_SURE_YOUR_ACCOUNT_AND_PASSWORD_IS_CORRECT');//implode("<br />",JError::getErrors());//'Make sure your account and password is correct';//Error ::getError();
$result['returnUrl'] = $return;
return $result;
}
} else {
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('PLEASE_MAKE_SURE_YOUR_ACCOUNT_AND_PASSWORD_IS_CORRECT');//implode("<br />",JError::getErrors());//'Make sure your account and password is correct';//Error ::getError();
$result['returnUrl'] = $return;
//.........这里部分代码省略.........
示例11: installExtensionAction
/**
* Action to handle install extension request.
*
* @param string $id Identified name of the extension to be installed.
*
* @return void
*/
public function installExtensionAction($id = null)
{
JSNTplHelper::isDisabledFunction('set_time_limit') or set_time_limit(0);
// Get necessary variables
$config = JFactory::getConfig();
$user = JFactory::getUser();
$tmpPath = $config->get('tmp_path');
if (empty($id)) {
$id = $this->request->getString('id');
}
// Disable debug system
$config->set('debug', 0);
// Path to sample data file
$xmlFiles = glob("{$tmpPath}/{$this->template['name']}_sampledata/*.xml");
if (empty($xmlFiles)) {
throw new Exception(JText::_('JSN_TPLFW_ERROR_CANNOT_EXTRACT_SAMPLE_DATA_PACKAGE'));
}
// Load XML document
$xml = simplexml_load_file(current($xmlFiles));
$extensions = $xml->xpath("//extension[@identifiedname=\"{$id}\"]");
if (!empty($extensions)) {
$extension = current($extensions);
$name = (string) $extension['name'];
$type = (string) $extension['type'];
switch ($type) {
case 'component':
$name = 'com_' . $name;
break;
case 'module':
$name = 'mod_' . $name;
break;
}
$this->_cleanExtensionAssets($name);
// Install JSN Extension Framework first if not already installed
if ($type == 'component') {
// Get details about JSN Extension Framework
$extfw = $xml->xpath('//extension[@identifiedname="ext_framework"]');
if (!empty($extfw)) {
$extfw = current($extfw);
if ($this->_getExtensionState((string) $extfw['name'], (string) $extfw['version']) != 'installed') {
// Install JSN Extension Framework
try {
$this->installExtensionAction('ext_framework');
} catch (Exception $e) {
throw $e;
}
}
}
}
}
// Download package from lightcart
try {
$packageFile = JSNTplApiLightcart::downloadPackage($id, 'FREE', null, null, "{$tmpPath}/{$this->template['name']}_sampledata/");
} catch (Exception $e) {
throw $e;
}
if (!is_file($packageFile)) {
throw new Exception("Package file not found: {$packageFile}");
}
// Load extension installation library
jimport('joomla.installer.helper');
// Rebuild menu structure
$this->_rebuildMenus();
// Extract downloaded package
$unpackedInfo = JInstallerHelper::unpack($packageFile);
$installer = JInstaller::getInstance();
if (empty($unpackedInfo) or !isset($unpackedInfo['dir'])) {
throw new Exception(JText::_('JSN_TPLFW_ERROR_CANNOT_EXTRACT_EXTENSION_PACKAGE_FILE'));
}
// Install extracted package
$installResult = $installer->install($unpackedInfo['dir']);
if ($installResult === false) {
foreach (JError::getErrors() as $error) {
throw $error;
}
}
// Clean up temporary data
JInstallerHelper::cleanupInstall($packageFile, $unpackedInfo['dir']);
$this->_activeExtension(array('type' => $type, 'name' => $name));
// Rebuild menu structure
$this->_rebuildMenus();
}
示例12: __destruct
/**
* Show the debug info
*
*/
function __destruct()
{
global $_PROFILER;
// Do not render if debugging is not enabled
if (!JDEBUG) {
return;
}
if (!$_PROFILER instanceof JProfiler) {
return;
}
// Load the language
$this->loadLanguage();
// Capture output
$contents = ob_get_contents();
ob_end_clean();
// No debug for Safari and Chrome redirection
if (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') !== false && substr($contents, 0, 50) == '<html><head><meta http-equiv="refresh" content="0;') {
echo $contents;
return;
}
$document = JFactory::getDocument();
$doctype = $document->getType();
// Only render for HTML output
if ($doctype !== 'html') {
echo $contents;
return;
}
// If the user is not allowed to view the output then end here
$filterGroups = (array) $this->params->get('filter_groups', null);
if (!empty($filterGroups)) {
$userGroups = JFactory::getUser()->get('groups');
if (!array_intersect($filterGroups, array_keys($userGroups))) {
echo $contents;
return;
}
}
// Load language file
$this->loadLanguage('plg_system_debug');
$profiler =& $_PROFILER;
ob_start();
echo '<div id="system-debug" class="profiler">';
$errors = JError::getErrors();
if (!empty($errors)) {
echo '<h4>' . JText::_('PLG_DEBUG_ERRORS') . '</h4><ol>';
while ($error = JError::getError(true)) {
echo '<li>' . $error->getMessage() . '<br /><h4>' . JText::_('PLG_DEBUG_INFO') . '</h4><pre>' . print_r($error->get('info'), true) . '</pre><br /><h4>' . JText::_('PLG_DEBUG_BACKTRACE') . '</h4>' . JError::renderBacktrace($error) . '</li>';
}
echo '</ol>';
}
if ($this->params->get('profile', 1)) {
echo '<h4>' . JText::_('PLG_DEBUG_PROFILE_INFORMATION') . '</h4>';
foreach ($profiler->getBuffer() as $mark) {
echo '<div>' . $mark . '</div>';
}
}
if ($this->params->get('memory', 1)) {
echo '<h4>' . JText::_('PLG_DEBUG_MEMORY_USAGE') . '</h4>';
$bytes = $profiler->getMemory();
echo JHtml::_('number.bytes', $bytes);
echo ' (' . number_format($bytes) . ' Bytes)';
}
if ($this->params->get('queries', 1)) {
$newlineKeywords = '#\\b(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)\\b#i';
$db = JFactory::getDbo();
echo '<h4>' . JText::sprintf('PLG_DEBUG_QUERIES_LOGGED', $db->getTicker()) . '</h4>';
if ($log = $db->getLog()) {
echo '<ol>';
$selectQueryTypeTicker = array();
$otherQueryTypeTicker = array();
foreach ($log as $k => $sql) {
// Start Query Type Ticker Additions
$fromStart = stripos($sql, 'from');
$whereStart = stripos($sql, 'where', $fromStart);
if ($whereStart === false) {
$whereStart = stripos($sql, 'order by', $fromStart);
}
if ($whereStart === false) {
$whereStart = strlen($sql) - 1;
}
$fromString = substr($sql, 0, $whereStart);
$fromString = str_replace("\t", " ", $fromString);
$fromString = str_replace("\n", " ", $fromString);
$fromString = trim($fromString);
// Initialize the select/other query type counts the first time:
if (!isset($selectQueryTypeTicker[$fromString])) {
$selectQueryTypeTicker[$fromString] = 0;
}
if (!isset($otherQueryTypeTicker[$fromString])) {
$otherQueryTypeTicker[$fromString] = 0;
}
// Increment the count:
if (stripos($sql, 'select') === 0) {
$selectQueryTypeTicker[$fromString] = $selectQueryTypeTicker[$fromString] + 1;
unset($otherQueryTypeTicker[$fromString]);
} else {
$otherQueryTypeTicker[$fromString] = $otherQueryTypeTicker[$fromString] + 1;
//.........这里部分代码省略.........
示例13: onAfterRender
/**
* Converting the site URL to fit to the HTTP request
*
*/
function onAfterRender()
{
global $_PROFILER;
// Do not render if debugging is not enabled
if (!JDEBUG) {
return;
}
$document =& JFactory::getDocument();
$doctype = $document->getType();
// Only render for HTML output
if ($doctype !== 'html') {
return;
}
// If the user is not allowed to view the output then end here
$filterGroups = (array) $this->params->get('filter_groups', null);
if (!empty($filterGroups)) {
$userGroups = JFactory::getUser()->get('groups');
if (!array_intersect($filterGroups, array_keys($userGroups))) {
return;
}
}
$profiler =& $_PROFILER;
ob_start();
echo '<div id="system-debug" class="profiler">';
$errors = JError::getErrors();
if (!empty($errors)) {
echo '<h4>' . JText::_('Errors') . '</h4><ol>';
while ($error = JError::getError(true)) {
echo '<li>' . $error->getMessage() . '<br /><h4>' . JText::_('Info') . '</h4><pre>' . print_r($error->get('info'), true) . '</pre><br /><h4>' . JText::_('Backtrace') . '</h4>' . JError::renderBacktrace($error) . '</li>';
}
echo '</ol>';
}
if ($this->params->get('profile', 1)) {
echo '<h4>' . JText::_('Debug_Profile_Information') . '</h4>';
foreach ($profiler->getBuffer() as $mark) {
echo '<div>' . $mark . '</div>';
}
}
if ($this->params->get('memory', 1)) {
echo '<h4>' . JText::_('Debug_Memory_Usage') . '</h4>';
echo number_format($profiler->getMemory());
}
if ($this->params->get('queries', 1)) {
$newlineKeywords = '#\\b(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)\\b#i';
$db =& JFactory::getDbo();
echo '<h4>' . JText::sprintf('Debug_Queries_logged', $db->getTicker()) . '</h4>';
if ($log = $db->getLog()) {
echo '<ol>';
foreach ($log as $k => $sql) {
$text = preg_replace($newlineKeywords, '<br /> \\0', $sql);
echo '<li>' . $text . '</li>';
}
echo '</ol>';
}
}
$lang =& JFactory::getLanguage();
if ($this->params->get('language_files', 1)) {
echo '<h4>' . JText::_('Debug_Language_Files_Loaded') . '</h4>';
echo '<ul>';
$extensions = $lang->getPaths();
foreach ($extensions as $extension => $files) {
foreach ($files as $file => $status) {
echo "<li>{$file} {$status}</li>";
}
}
echo '</ul>';
}
if ($this->params->get('language_strings')) {
$stripFirst = $this->params->get('strip-first');
$stripPref = $this->params->get('strip-prefix');
$stripSuff = $this->params->get('strip-suffix');
echo '<h4>' . JText::_('Debug_Untranslated_Strings') . '</h4>';
echo '<pre>';
$orphans = $lang->getOrphans();
if (count($orphans)) {
ksort($orphans, SORT_STRING);
$guesses = array();
foreach ($orphans as $key => $occurance) {
if (is_array($occurance) and isset($occurance[0])) {
$info =& $occurance[0];
$file = @$info['file'];
if (!isset($guesses[$file])) {
$guesses[$file] = array();
}
// Prepare the key
if (($pos = strpos($info['string'], '=')) > 0) {
$parts = explode('=', $info['string']);
$key = $parts[0];
$guess = $parts[1];
} else {
$guess = str_replace('_', ' ', $info['string']);
if ($stripFirst) {
$parts = explode(' ', $guess);
if (count($parts) > 1) {
array_shift($parts);
$guess = implode(' ', $parts);
//.........这里部分代码省略.........
示例14: writeXML
/**
* Write XML sitemap file
*
* @param string $file content that should be written in the sitemap file
* @param string $location full path to the sitemap file that is being written
* @param string $option the name of the component
* @param string $sitemap_url url of the sitemap file
* @return nothing
*/
function writeXML($file, $location, $option, $sitemap_url)
{
$app =& JFactory::getApplication();
$buffer = pack("CCC", 0xef, 0xbb, 0xbf);
$buffer .= utf8_encode($file);
if (JFile::write($location, $buffer)) {
$app->enqueueMessage("Success, wrote {$location}");
} else {
$errors[] = JError::getErrors();
foreach ($errors as $error) {
$app->enqueueMessage($error->message, 'error');
}
$app->enqueueMessage("{$location} is not writable", 'error');
}
return;
}
示例15: install
/**
* Install downloaded update package.
*
* @param string $path Path to downloaded update package.
*
* @return void
*/
public function install($path)
{
$config = JFactory::getConfig();
// Initialize update package path
$path = $config->get('tmp_path') . '/' . $path;
if (!is_file($path)) {
throw new Exception(JText::_('JSN_EXTFW_PACKAGE_FILE_NOT_FOUND') . ': ' . $path);
}
// Extract update package
if (!JArchive::extract($path, substr($path, 0, -4))) {
throw new Exception(JText::_('JSN_EXTFW_UPDATE_EXTRACT_PACKAGE_FAIL'));
}
$path = substr($path, 0, -4);
// Do any preparation needed before installing update package
try {
$this->beforeInstall($path);
} catch (Exception $e) {
throw $e;
}
// Get Joomla version object
$JVersion = new JVersion();
// Switch off debug mode to catch JInstaller error message manually
$config = JFactory::getConfig();
$debug = $config->get('debug');
$config->set('debug', version_compare($JVersion->RELEASE, '3.0', '<') ? false : true);
// Install update package
$installer = JInstaller::getInstance();
try {
$installer->update($path);
} catch (Exception $e) {
throw $e;
}
// Restore debug settings
$config->set('debug', $debug);
// Check if installation success
$messages = JFactory::getApplication()->getMessageQueue();
if (class_exists('JError')) {
$messages = array_merge(JError::getErrors(), $messages);
}
foreach ($messages as $message) {
if (is_array($message) and @$message['type'] == 'error' or is_object($message) and (!method_exists($message, 'get') or $message->get('level') == E_ERROR)) {
$errors[is_array($message) ? $message['message'] : $message->getMessage()] = 1;
}
}
if (@count($errors)) {
throw new JException('<ul><li>' . implode('</li><li>', array_keys($errors)) . '</li></ul>');
}
// Do any extra work needed after installing update package
try {
$this->afterInstall($path);
} catch (Exception $e) {
throw $e;
}
// Complete AJAX based update package installation task
jexit('DONE');
}