本文整理汇总了PHP中JError::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::getError方法的具体用法?PHP JError::getError怎么用?PHP JError::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::getError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vote
/**
* Method to save a vote.
*
* @return void
* @since 1.8
*/
function vote()
{
// Check for request forgeries.
JRequest::checkToken() or $this->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
$app = JFactory::getApplication();
$user_rating = JRequest::getInt('user_rating', -1);
if ($user_rating > -1) {
$id = JRequest::getInt('id', 0);
$viewName = JRequest::getString('view', $this->default_view);
$model = $this->getModel($viewName);
$r = new JObject();
$success = $model->storeVote($id, $user_rating);
$item = &$model->getItem($id);
$r->rating = intval($item->rating);
$r->rating_count = intval($item->rating_count);
if ($success) {
$app->enqueueMessage(JText::_('COM_CONTENT_ARTICLE_VOTE_SUCCESS'));
} else {
$error = JError::getError();
if (!$error) {
$app->enqueueMessage(JText::_('COM_CONTENT_ARTICLE_VOTE_FAILURE'));
}
}
$this->sendJsonResponse($r);
}
}
示例2: store
/**
* Method to store a file to the FTP server
*
* @param string $local Path to local file to store on the FTP server
* @param string $remote FTP path to file to create
*
* @throws Exception
*
* @return boolean True if successful
*/
public function store($local, $remote = null)
{
//-- Avoid all this mess by throwing appropriate exceptions !!
if (false === parent::store($local, $remote)) {
throw new Exception(JError::getError());
}
}
示例3: testGetError
/**
* @covers JError::getError
*/
public function testGetError()
{
JErrorInspector::manipulateStack(array());
$this->assertThat(JError::getError(), $this->isFalse(), 'There was no error on the error stack but getError did not return false');
// we normally couldn't have strings, but this is only a test
JErrorInspector::manipulateStack(array('Error1', 'Error2'));
$this->assertThat(JError::getError(), $this->equalTo('Error1'), 'We did not get the proper value back from getError - it should have returned our fake error');
$this->assertThat(JErrorInspector::inspectStack(), $this->equalTo(array('Error1', 'Error2')), 'The stack was changed by getError even though unset was false');
$this->assertThat(JError::getError(true), $this->equalTo('Error1'), 'We did not get the proper value back from getError - it should have returned our fake error');
$this->assertThat(JErrorInspector::inspectStack(), $this->equalTo(array('Error2')), 'The stack was either not changed or changed the wrong way by getError (with unset true)');
// here we remove any junk left on the error stack
JErrorInspector::manipulateStack(array());
}
示例4: loadUserByCredentials
public function loadUserByCredentials($user, $pass)
{
jimport('joomla.user.authentication');
$authenticate = JAuthentication::getInstance();
$response = $authenticate->authenticate(array('username' => $user, 'password' => $pass));
if ($response->status === JAuthentication::STATUS_SUCCESS) {
$instance = JUser::getInstance($response->username);
if ($instance === false) {
$this->setError(JError::getError());
return false;
}
} else {
if (isset($response->error_message)) {
$this->setError($response->error_message);
} else {
$this->setError($response->getError());
}
return false;
}
return $instance;
}
示例5:
<label for="modlgn_username"><?php
echo JText::_('Username');
?>
</label>
<input name="username" id="modlgn_username" type="text" class="inputbox" size="15" />
</p>
<p id="form-login-password">
<label for="modlgn_passwd"><?php
echo JText::_('Password');
?>
</label>
<input name="passwd" id="modlgn_passwd" type="password" class="inputbox" size="15" />
</p>
<?php
if ($error = JError::getError(true)) {
echo '<p id="login-error-message">';
echo $error->get('message');
echo '<p>';
}
?>
<p id="form-login-lang" style="clear: both;">
<label for="lang"><?php
echo JText::_('Language');
?>
</label>
<?php
echo $langs;
?>
</p>
<div class="button_holder">
示例6: cleanBogusError
protected function cleanBogusError()
{
$errors = array();
while (($error = JError::getError(true)) !== false) {
if (!($error->get('code') == 1 && $error->get('level') == 2 && $error->get('message') == JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE'))) {
$errors[] = $error;
}
}
foreach ($errors as $error) {
JError::addToStack($error);
}
$app =& JFactory::getApplication();
$enqueued_messages = $app->get('_messageQueue');
$other_messages = array();
if (!empty($enqueued_messages) && is_array($enqueued_messages)) {
foreach ($enqueued_messages as $enqueued_message) {
if (!($enqueued_message['message'] == JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE') && $enqueued_message['type']) == 'error') {
$other_messages[] = $enqueued_message;
}
}
}
$app->set('_messageQueue', $other_messages);
}
示例7: register
function register($from_cb = 0, $freeCourse = false)
{
global $Itemid, $JLMS_DB, $JLMS_CONFIG, $JLMS_SESSION, $version, $task, $my;
$reg_success = false;
$msg = '';
$username = JRequest::getVar('username');
$password = JRequest::getVar('password');
$usersConfig =& JComponentHelper::getParams('com_users');
$app =& JFactory::getApplication();
if ($from_cb) {
global $task;
$task = 'saveregisters';
$_REQUEST['task'] = 'saveregisters';
$_GET['task'] = 'saveregisters';
$_POST['task'] = 'saveregisters';
JRequest::setVar('task', $task);
ob_start();
global $ueConfig;
$_CB_joomla_adminpath = $JLMS_CONFIG->get('absolute_path') . "/administrator";
$_CB_adminpath = $_CB_joomla_adminpath . "/components/com_comprofiler";
include_once $_CB_adminpath . "/ue_config.php";
if ($usersConfig->get('allowUserRegistration')) {
$allowUserRegistration = true;
} else {
$allowUserRegistration = false;
}
// check if CB registration is allowed
if (!$allowUserRegistration && (!isset($ueConfig['reg_admin_allowcbregistration']) || $ueConfig['reg_admin_allowcbregistration'] != '1') || $my->id) {
$msg = _JLMS_REGISTRATION_DISABLED;
$reg_success = false;
} else {
$existingUser = null;
$query = "SELECT * " . "\n FROM #__users u " . "\n WHERE u.username = '" . $JLMS_DB->getEscaped($username) . "'";
$JLMS_DB->setQuery($query);
$existingUser = $JLMS_DB->loadObjectList();
// new registration will be failed if user with such username is already exists.
if (isset($existingUser[0])) {
$reg_success = false;
}
require_once JPATH_SITE . '/components/com_comprofiler/comprofiler.html.php';
require_once JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
$msg = @ob_get_contents();
$msg = str_replace('<br />', '**br**', $msg);
$msg = str_replace('</div><div', '**br**', $msg);
$msg = strip_tags($msg);
$msg = str_replace('**br**', '<br />', $msg);
$msg = trim($msg);
if (substr($msg, 0, 6) == 'alert(') {
preg_match('`alert\\(\'(.*)\'\\);(.*)`isU', $msg, $matches2);
# <script...>(#our_content#)</script> areas
if (isset($matches2[1])) {
$msg = $matches2[1];
}
}
@ob_end_clean();
$filter =& JFilterInput::getInstance();
if ($filter->clean($msg) == $filter->clean(_UE_REG_COMPLETE)) {
$msg = '';
$reg_success = true;
}
}
} else {
if (JLMS_Jversion() == 2) {
if (JLMS_J16version()) {
$lang =& JFactory::getLanguage();
$lang->load('com_users');
require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'models' . DS . 'registration.php';
// Create the controller
$model = new UsersModelRegistration();
$requestData = JRequest::getVar('jform', array(), 'post', 'array');
$username = $requestData['username'];
$password = $requestData['password1'];
JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields');
$form = $model->getForm();
$return = $model->validate($form, $requestData);
// Save the data in the session.
if ($return === false) {
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
$msg .= '<br />' . $errors[$i];
}
$app->setUserState('users.registration.form.data', $requestData);
} else {
$return = $model->register($requestData);
if ($return === false) {
$msg .= '<br />' . JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError());
$app->setUserState('users.registration.form.data', $requestData);
}
}
if ($return === 'adminactivate') {
$reg_complete_activate_found = true;
} else {
if ($return === 'useractivate') {
$reg_complete_activate_found = true;
} else {
if ($return !== false) {
$reg_success = true;
$reg_complete_found = true;
//.........这里部分代码省略.........
示例8: array
/**
* Load the connection associated with the table
*
* @return object database object using connection details false if connection error
*/
function &getDb()
{
static $dbs;
if (!isset($dbs)) {
$dbs = array();
}
$cn = $this->getConnection();
$session = JFactory::getSession();
if (JRequest::getCmd('task') == 'test') {
$session->clear('fabrik.connection.' . $cn->id);
$dbs = array();
$this->_connection = null;
$cn = $this->getConnection();
}
if (!array_key_exists($cn->id, $dbs)) {
// $$$rob lets see if we have an exact config match with J db if so just return that
$conf = JFactory::getConfig();
$host = $conf->get('host');
$user = $conf->get('user');
$password = $conf->get('password');
$database = $conf->get('db');
$prefix = $conf->get('dbprefix');
$driver = $conf->get('dbtype');
$debug = $conf->get('debug');
$default_options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
$options = $this->getConnectionOptions($cn);
if ($this->_compareConnectionOpts($default_options, $options)) {
$dbs[$cn->id] = FabrikWorker::getDbo();
} else {
$dbs[$cn->id] = JDatabase::getInstance($options);
}
if (JError::isError($dbs[$cn->id]) || is_a($dbs[$cn->id], 'JException') || $dbs[$cn->id]->getErrorNum() !== 0) {
/**
* $$$Rob - not sure why this is happening on badmintonrochelais.com (mySQL 4.0.24) but it seems like
* you can only use one connection on the site? As JDatabase::getInstance() forces a new connection if its options
* signature is not found, then fabrik's default connection won't be created, hence defaulting to that one
*/
if ($cn->default == 1 && JRequest::getCmd('task') !== 'test') {
$dbs[$cn->id] = FabrikWorker::getDbo();
// $$$rob remove the error from the error stack
// if we dont do this the form is not rendered
JError::getError(true);
} else {
$app = JFactory::getApplication();
if (!$app->isAdmin()) {
JError::raiseError(E_ERROR, 'Could not connection to database', $default_options);
jexit('Could not connection to database - possibly a menu item which doesn\'t link to a fabrik table');
} else {
// $$$ rob - unset the connection as caching it will mean that changes we make to the incorrect connection in admin, will not result
// in the test connection link informing the user that the changed connection properties are now correct
if (JRequest::getCmd('task') == 'test') {
$session->clear('fabrik.connection.' . $cn->id);
$this->_connection = null;
$level = E_NOTICE;
} else {
$level = E_ERROR;
}
return JError::raise($level, 500, 'Could not connection to database cid = ' . $cn->id);
}
}
}
}
return $dbs[$cn->id];
}
示例9: getContact
/**
* Returns contact details or user details as fall back
*
* @param int id key of user
* @param string attrib Requested attribute of the user object
* @return mixed row Attribute or row object
*/
public static function getContact($id, $attrib = 'Object')
{
$db = JFactory::getDBO();
static $rows = array();
if ($id <= 0) {
return null;
}
if (!isset($rows[$id])) {
$user = JFactory::getUser();
$rows[$id] = null;
$query = "SELECT ju.id, ju.name, ju.username, ju.sendEmail, ju.email, cd.name as contactname, " . ' CASE WHEN CHAR_LENGTH(cd.alias) THEN CONCAT_WS(\':\', cd.id, cd.alias) ELSE cd.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(cat.alias) THEN CONCAT_WS(\':\', cat.id, cat.alias) ELSE cat.id END AS catslug ' . " \n FROM #__users AS ju" . "\n LEFT JOIN #__contact_details AS cd ON cd.user_id = ju.id " . "\n LEFT JOIN #__categories AS cat ON cat.id = cd.catid " . "\n WHERE block ='0'" . "\n AND cd.published =1 " . "\n AND cd.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND cat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ju.id = " . $id;
$db->setQuery($query);
$rows[$id] = $db->loadObject();
if (is_null($rows[$id])) {
// if the user has been deleted then try to suppress the warning
// this causes a problem in Joomla 2.5.1 on some servers
if (version_compare(JVERSION, '2.5', '>=')) {
$rows[$id] = JEVHelper::getUser($id);
} else {
$handlers = JError::getErrorHandling(2);
JError::setErrorHandling(2, "ignore");
$rows[$id] = JEVHelper::getUser($id);
foreach ($handlers as $handler) {
if (!is_array($handler)) {
JError::setErrorHandling(2, $handler);
}
}
if ($rows[$id]) {
$error = JError::getError(true);
}
}
}
}
if ($attrib == 'Object') {
return $rows[$id];
} elseif (isset($rows[$id]->{$attrib})) {
return $rows[$id]->{$attrib};
} else {
return null;
}
}
示例10: __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;
//.........这里部分代码省略.........
示例11: run
/**
* Perform the action.
*
* @param EcrProjectZiper $ziper
*
* @return \EcrProjectAction
*/
public function run(EcrProjectZiper $ziper)
{
$ziper->logger->log('Executing FTP transfer');
$user = trim($this->user);
$pass = trim($this->pass);
if ('' == $user) {
$text = 'FTP User';
$command = escapeshellcmd('DISPLAY=:0 XAUTHORITY=/home/elkuku/.Xauthority' . ' kdialog --title "' . $text . '" --inputbox "' . $text . '"');
$ziper->logger->log('Executing: ' . $command);
$user = shell_exec($command . ' 2>&1');
if ('' == $user) {
$ziper->logger->log('ERROR: No user name given', 'FTP user', JLog::ERROR);
return $this;
}
}
if ('' == $pass) {
$text = 'FTP Password';
$command = escapeshellcmd('DISPLAY=:0 XAUTHORITY=/home/elkuku/.Xauthority' . ' kdialog --title "' . $text . '" --inputbox "' . $text . '"');
$ziper->logger->log('Executing: ' . $command);
$pass = shell_exec($command . ' 2>&1');
if ('' == $pass) {
$ziper->logger->log('ERROR: No password given', 'FTP user', JLog::ERROR);
return $this;
}
}
$ftp = EcrFtp::getClient($this->host, $this->port, null, $user, $pass);
$files = explode(',', $this->files);
$packages = $ziper->getCreatedFiles();
foreach ($files as $file) {
$file = trim($file);
$path = '';
$fileName = '';
switch ($file) {
case 'package':
$path = $packages[0]->path;
break;
default:
$ziper->logger->log('ERROR: Unknown file type: ' . $file, 'FTP transfer', JLog::ERROR);
}
$remote = null;
if ($this->folder) {
$remote = $this->folder . '/' . basename($path);
}
if (false == $ftp->store($path, $remote)) {
//@todo: deprecated JError
$error = JError::getError();
$ziper->logger->log('ERROR: ' . $error, 'FTP transfer (JFTP)', JLog::ERROR);
} else {
$ziper->logger->log('File transfered: ' . $fileName);
}
}
return $this;
}
示例12: array
/**
* Load the connection associated with the table
*
* @return object database object using connection details false if connection error
*/
public function &getDb()
{
if (!isset(self::$dbs)) {
self::$dbs = array();
}
$error = false;
$cn = $this->getConnection();
$app = JFactory::getApplication();
$input = $app->input;
if ($input->get('task') == 'test') {
self::$dbs = array();
$this->connection = null;
$cn = $this->getConnection();
}
if (!array_key_exists($cn->id, self::$dbs)) {
if ($this->isJdb()) {
$db = FabrikWorker::getDbo();
} else {
$options = $this->getConnectionOptions($cn);
$db = $this->getDriverInstance($options);
}
try {
$db->connect();
} catch (RuntimeException $e) {
$error = true;
}
self::$dbs[$cn->id] = $db;
if ($error) {
/**
* $$$Rob - not sure why this is happening on badmintonrochelais.com (mySQL 4.0.24) but it seems like
* you can only use one connection on the site? As JDatabase::getInstance() forces a new connection if its options
* signature is not found, then fabrik's default connection won't be created, hence defaulting to that one
*/
if ($cn->default == 1 && $input->get('task') !== 'test') {
self::$dbs[$cn->id] = FabrikWorker::getDbo();
// $$$rob remove the error from the error stack
// if we don't do this the form is not rendered
JError::getError(true);
} else {
if (!$app->isAdmin()) {
throw new RuntimeException('Could not connection to database', E_ERROR);
} else {
// $$$ rob - unset the connection as caching it will mean that changes we make to the incorrect connection in admin, will not result
// in the test connection link informing the user that the changed connection properties are now correct
if ($input->get('task') == 'test') {
$this->connection = null;
$level = E_NOTICE;
} else {
$level = E_ERROR;
}
throw new RuntimeException('Could not connection to database cid = ' . $cn->id, $level);
}
}
}
}
return self::$dbs[$cn->id];
}
示例13: bookInvoiceInEconomic
/**
* Method to book invoice and send mail in E-conomic
*
* @access public
* @return array
*/
public function bookInvoiceInEconomic($order_id, $checkOrderStatus = 1, $rmaCRMOrder = 0, $bookinvoicedate = 0)
{
$file = '';
if (ECONOMIC_INTEGRATION == 1) {
$orderdetail = $this->_order_functions->getOrderDetails($order_id);
if ($orderdetail->invoice_no != '' && $orderdetail->is_booked == 0) {
if (ECONOMIC_INVOICE_DRAFT == 2 && $orderdetail->order_status == BOOKING_ORDER_STATUS || $checkOrderStatus == 0 || $rmaCRMOrder == 1) {
$user_billinginfo = $this->_order_functions->getOrderBillingUserInfo($order_id);
if ($user_billinginfo->is_company == 0 || !$user_billinginfo->ean_number && $user_billinginfo->is_company == 1) {
$currency = CURRENCY_CODE;
$eco['invoiceHandle'] = $orderdetail->invoice_no;
$eco['debtorHandle'] = intVal($user_billinginfo->users_info_id);
$eco['currency_code'] = $currency;
$eco['amount'] = $orderdetail->order_total;
$eco['order_number'] = $orderdetail->order_number;
$eco['order_id'] = $orderdetail->order_id;
$currectinvoiceData = $this->_dispatcher->trigger('checkDraftInvoice', array($eco));
if (count($currectinvoiceData) > 0 && trim($currectinvoiceData[0]->OtherReference) == $orderdetail->order_number) {
$this->updateInvoiceDateInEconomic($orderdetail, $bookinvoicedate);
if ($user_billinginfo->is_company == 1 && $user_billinginfo->company_name != '') {
$eco['name'] = $user_billinginfo->company_name;
} else {
$eco['name'] = $user_billinginfo->firstname . " " . $user_billinginfo->lastname;
}
$paymentInfo = $this->_order_functions->getOrderPaymentDetail($orderdata->order_id);
if (count($paymentInfo) > 0) {
$paymentmethod = $this->_order_functions->getPaymentMethodInfo($paymentInfo[0]->payment_method_class);
if (count($paymentmethod) > 0) {
$paymentparams = new JRegistry($paymentmethod[0]->params);
$eco['economic_payment_terms_id'] = $paymentparams->get('economic_payment_terms_id');
$eco['economic_design_layout'] = $paymentparams->get('economic_design_layout');
}
}
if (ECONOMIC_BOOK_INVOICE_NUMBER == 1) {
$bookhandle = $this->_dispatcher->trigger('CurrentInvoice_Book', array($eco));
} else {
$bookhandle = $this->_dispatcher->trigger('CurrentInvoice_BookWithNumber', array($eco));
}
if (count($bookhandle) > 0 && isset($bookhandle[0]->Number)) {
$bookinvoice_number = $eco['bookinvoice_number'] = $bookhandle[0]->Number;
if (ECONOMIC_BOOK_INVOICE_NUMBER == 1) {
$this->updateBookInvoiceNumber($order_id, $bookinvoice_number);
}
$bookinvoicepdf = $this->_dispatcher->trigger('bookInvoice', array($eco));
if (JError::isError(JError::getError())) {
return $file;
} elseif ($bookinvoicepdf != "") {
$file = JPATH_ROOT . '/components/com_redshop/assets/orders/rsInvoice_' . $order_id . '.pdf';
JFile::write($file, $bookinvoicepdf);
if (is_file($file)) {
$this->updateBookInvoice($order_id);
}
}
}
}
}
}
}
}
return $file;
}
示例14: 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);
//.........这里部分代码省略.........
示例15: testGetInstance
/**
* Testing GetInstance().
*
* @return void
*/
public function testGetInstance()
{
include_once JPATH_BASE . '/libraries/joomla/plugin/helper.php';
include_once JPATH_BASE . '/libraries/joomla/user/user.php';
include_once JPATH_BASE . '/libraries/joomla/session/session.php';
$user = new JUser;
/**$mockSession = $this->getMock('JSession', array( '_start', 'get'));
$mockSession->expects($this->any())->method('get')->with($this->equalTo('user'))->will(
$this->returnValue($user)
);**/
$mockSession = new Mock_SessionJAuthenticate();
$mockSession->set('user', $user);
JFactory::$session = $mockSession;
$instance1 = JAuthentication::getInstance();
/***
* These calls involving getError cause really bad things to happen in certain circumstances on some setups.
* Commenting them out until we can figure out what and why (or fix it so it doesn't happen)
$error = JError::getError();
$this->assertThat(
$error,
$this->equalTo(null)
);
*/
$instance2 = JAuthentication::getInstance();
$error = JError::getError();
/***
* These calls involving getError cause really bad things to happen in certain circumstances on some setups.
* Commenting them out until we can figure out what and why (or fix it so it doesn't happen)
$this->assertThat(
$error,
$this->equalTo(null)
);
*/
$this->assertThat(
$instance1,
$this->equalTo($instance2)
);
}