当前位置: 首页>>代码示例>>PHP>>正文


PHP JLog::add方法代码示例

本文整理汇总了PHP中JLog::add方法的典型用法代码示例。如果您正苦于以下问题:PHP JLog::add方法的具体用法?PHP JLog::add怎么用?PHP JLog::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JLog的用法示例。


在下文中一共展示了JLog::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         if ($model->delete($cid)) {
             $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         // Invoke the postDelete method to allow for the child class to access the model.
         $this->postDeleteHook($model, $cid);
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
开发者ID:AndreKoepke,项目名称:Einsatzkomponente,代码行数:28,代码来源:alarmierungsarten.php

示例2: log

 /**
  * Logs with an arbitrary level.
  *
  * @param   mixed   $level    The log level.
  * @param   string  $message  The log message.
  * @param   array   $context  Additional message context.
  *
  * @return  null
  *
  * @since   4.0
  * @throws  InvalidArgumentException
  */
 public function log($level, $message, array $context = array())
 {
     // Make sure the log level is valid
     if (!array_key_exists($level, $this->priorityMap)) {
         throw new InvalidArgumentException('An invalid log level has been given.');
     }
     // Map the level to Joomla's priority
     $priority = $this->priorityMap[$level];
     $category = null;
     $date = null;
     // If a message category is given, map it
     if (!empty($context['category'])) {
         $category = $context['category'];
     }
     // If a message timestamp is given, map it
     if (!empty($context['date'])) {
         $date = $context['date'];
     }
     // Joomla's logging API will only process a string or a JLogEntry object, if $message is an object without __toString() we can't use it
     if (!is_string($message) && !$message instanceof \JLogEntry) {
         if (!is_object($message) || !method_exists($message, '__toString')) {
             throw new InvalidArgumentException('The message must be a string, a JLogEntry object, or an object implementing the __toString() method.');
         }
         $message = (string) $message;
     }
     $this->logger->add($message, $priority, $category, $date, $context);
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:39,代码来源:DelegatingPsrLogger.php

示例3: getOptions

 /**
  * Method to get the field options for the list of installed editors.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     JLog::add('JFormFieldEditors is deprecated. Use JFormFieldPlugins instead (with folder="editors").', JLog::WARNING, 'deprecated');
     // Get the database object and a new query object.
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     // Build the query.
     $query->select('element AS value, name AS text');
     $query->from('#__extensions');
     $query->where('folder = ' . $db->quote('editors'));
     $query->where('enabled = 1');
     $query->order('ordering, name');
     // Set the query and load the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     $lang = JFactory::getLanguage();
     foreach ($options as $i => $option) {
         $lang->load('plg_editors_' . $option->value, JPATH_ADMINISTRATOR, null, false, false) || $lang->load('plg_editors_' . $option->value, JPATH_PLUGINS . '/editors/' . $option->value, null, false, false) || $lang->load('plg_editors_' . $option->value, JPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load('plg_editors_' . $option->value, JPATH_PLUGINS . '/editors/' . $option->value, $lang->getDefault(), false, false);
         $options[$i]->text = JText::_($option->text);
     }
     // Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseWarning(500, $db->getErrorMsg());
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:sergy444,项目名称:joomla,代码行数:35,代码来源:editors.php

示例4: __construct

 /**
  * Constructor
  *
  * @param   mixed    $response  The Response data.
  * @param   string   $message   The main response message.
  * @param   boolean  $error     True, if the success flag shall be set to false, defaults to false.
  *
  * @since		2.5
  * @deprecated	4.0	 Use JResponseJson instead.
  */
 public function __construct($response = null, $message = null, $error = false)
 {
     JLog::add('Class JJsonResponse is deprecated. Use class JResponseJson instead.', JLog::WARNING, 'deprecated');
     $this->message = $message;
     // Get the message queue.
     $messages = JFactory::getApplication()->getMessageQueue();
     // Build the sorted messages list.
     if (is_array($messages) && count($messages)) {
         foreach ($messages as $message) {
             if (isset($message['type']) && isset($message['message'])) {
                 $lists[$message['type']][] = $message['message'];
             }
         }
     }
     // If messages exist add them to the output.
     if (isset($lists) && is_array($lists)) {
         $this->messages = $lists;
     }
     // Check if we are dealing with an error.
     if ($response instanceof Exception) {
         // Prepare the error response.
         $this->success = false;
         $this->error = true;
         $this->message = $response->getMessage();
     } else {
         // Prepare the response data.
         $this->success = !$error;
         $this->error = $error;
         $this->data = $response;
     }
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:41,代码来源:jsonresponse.php

示例5: mootools

	/**
	 * Deprecated. Use JHtmlBehavior::framework() instead.
	 *
	 * @param   boolean  $debug  Is debugging mode on? [optional]
	 *
	 * @return  void
	 *
	 * @since   11.1
	 *
	 * @deprecated    12.1
	 */
	public static function mootools($debug = null)
	{
		// Deprecation warning.
		JLog::add('JBehavior::mootools is deprecated.', JLog::WARNING, 'deprecated');

		self::framework(true, $debug);
	}
开发者ID:nikosdion,项目名称:Akeeba-Example,代码行数:18,代码来源:behavior.php

示例6: __construct

 /**
  * Constructor
  *
  * @param   JDatabaseDriver  $db  Database driver object.
  *
  * @since   11.1
  * @deprecated  13.3  Use SQL queries to interact with the session table.
  */
 public function __construct(JDatabaseDriver $db)
 {
     JLog::add('JTableSession is deprecated. Use SQL queries directly to interact with the session table.', JLog::WARNING, 'deprecated');
     parent::__construct('#__session', 'session_id', $db);
     $this->guest = 1;
     $this->username = '';
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:15,代码来源:session.php

示例7: getInput

 /**
  * Method to get the user group field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     JLog::add('JFormFieldUsergroup is deprecated. Use JFormFieldUserGroupList instead.', JLog::WARNING, 'deprecated');
     $options = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
     $attr .= $this->disabled ? ' disabled' : '';
     $attr .= $this->size ? ' size="' . $this->size . '"' : '';
     $attr .= $this->multiple ? ' multiple' : '';
     $attr .= $this->required ? ' required aria-required="true"' : '';
     $attr .= $this->autofocus ? ' autofocus' : '';
     // Initialize JavaScript field attributes.
     $attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
     $attr .= !empty($this->onclick) ? ' onclick="' . $this->onclick . '"' : '';
     // Iterate through the children and build an array of options.
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         $disabled = (string) $option['disabled'];
         $disabled = $disabled == 'true' || $disabled == 'disabled' || $disabled == '1';
         // Create a new option object based on the <option /> element.
         $tmp = JHtml::_('select.option', (string) $option['value'], trim((string) $option), 'value', 'text', $disabled);
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     return JHtml::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:41,代码来源:usergroup.php

示例8: save

 /**
  * Save an item
  */
 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     $data = $app->input->post->get('jform', array(), 'array');
     $itemId = JArrayHelper::getValue($data, "id");
     $redirectData = array("task" => $this->getTask(), "id" => $itemId);
     $model = $this->getModel();
     /** @var $model SocialCommunityModelCountry */
     $form = $model->getForm($data, false);
     /** @var $form JForm */
     if (!$form) {
         throw new Exception(JText::_("COM_SOCIALCOMMUNITY_ERROR_FORM_CANNOT_BE_LOADED"));
     }
     // Validate the form
     $validData = $model->validate($form, $data);
     // Check for errors
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectData);
         return;
     }
     try {
         $itemId = $model->save($validData);
         $redirectData["id"] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_('COM_SOCIALCOMMUNITY_COUNTRY_SAVED'), $redirectData);
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:34,代码来源:country.php

示例9: getProjectFunds

 public function getProjectFunds()
 {
     // Create response object
     $response = new Prism\Response\Json();
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     $itemId = $app->input->getInt('id');
     // Check for errors.
     if (!$itemId) {
         $response->setTitle(JText::_('COM_CROWDFUNDINGFINANCE_FAIL'))->setText(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_INVALID_PROJECT'))->failure();
         echo $response;
         JFactory::getApplication()->close();
     }
     try {
         // Get statistics
         $project = new Crowdfunding\Statistics\Project(JFactory::getDbo(), $itemId);
         $data = $project->getFundedAmount();
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         $response->setTitle(JText::_('COM_CROWDFUNDINGFINANCE_FAIL'))->setText(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_SYSTEM'))->failure();
         echo $response;
         JFactory::getApplication()->close();
         throw new Exception(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_SYSTEM'));
     }
     $response->setData($data)->success();
     echo $response;
     JFactory::getApplication()->close();
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:28,代码来源:statistics.raw.php

示例10: save

 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $data = $this->input->post->get('jform', array(), 'array');
     $itemId = ArrayHelper::getValue($data, "id");
     $redirectData = array("task" => $this->getTask(), "id" => $itemId);
     $model = $this->getModel();
     /** @var $model GamificationModelRank */
     $form = $model->getForm($data, false);
     /** @var $form JForm */
     if (!$form) {
         throw new Exception(JText::_("COM_GAMIFICATION_ERROR_FORM_CANNOT_BE_LOADED"), 500);
     }
     // Validate the form
     $validData = $model->validate($form, $data);
     // Check for errors
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectData);
         return;
     }
     try {
         $itemId = $model->save($validData);
         $redirectData["id"] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_GAMIFICATION_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_('COM_GAMIFICATION_LEVEL_SAVED'), $redirectData);
 }
开发者ID:bellodox,项目名称:GamificationPlatform,代码行数:29,代码来源:level.php

示例11: read

 public function read()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $cid = $this->input->get('cid', array(), 'array');
     $data = array('read' => 1, 'notread' => 0);
     $task = $this->getTask();
     $value = ArrayHelper::getValue($data, $task, 0, 'int');
     $redirectOptions = array("view" => "notifications");
     // Make sure the item ids are integers
     ArrayHelper::toInteger($cid);
     if (empty($cid)) {
         $this->displayNotice(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), $redirectOptions);
         return;
     }
     try {
         $model = $this->getModel();
         $model->read($cid, $value);
     } catch (RuntimeException $e) {
         $this->displayWarning($e->getMessage(), $redirectOptions);
         return;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_GAMIFICATION_ERROR_SYSTEM'));
     }
     if ($value == 1) {
         $msg = $this->text_prefix . '_N_ITEMS_READ';
     } else {
         $msg = $this->text_prefix . '_N_ITEMS_NOT_READ';
     }
     $this->displayMessage(JText::plural($msg, count($cid)), $redirectOptions);
 }
开发者ID:bellodox,项目名称:GamificationPlatform,代码行数:33,代码来源:notifications.php

示例12: save

 /**
  * Save an item
  */
 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator * */
     $data = $app->input->post->get('jform', array(), 'array');
     $itemId = JArrayHelper::getValue($data, "id");
     // Prepare return data
     $redirectOptions = array("task" => $this->getTask(), "id" => $itemId);
     $model = $this->getModel();
     /** @var $model VirtualCurrencyModelTransaction * */
     $form = $model->getForm($data, false);
     /** @var $form JForm * */
     if (!$form) {
         throw new Exception(JText::_("COM_VIRTUALCURRENCY_ERROR_FORM_CANNOT_BE_LOADED"), 500);
     }
     // Validate the form
     $validData = $model->validate($form, $data);
     // Check for errors.
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectOptions);
         return;
     }
     try {
         $itemId = $model->save($validData);
         // Prepare return data
         $redirectOptions["id"] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_VIRTUALCURRENCY_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_("COM_VIRTUALCURRENCY_TRANSACTION_SAVED"), $redirectOptions);
 }
开发者ID:bellodox,项目名称:VirtualCurrency,代码行数:36,代码来源:transaction.php

示例13: delete

 /**
  * Remove an item.
  *
  * @throws  Exception
  * @return  void
  *
  * @since   12.2
  */
 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     /* @var $app JApplicationAdministrator */
     // Gets the data from the form
     $cid = $this->input->post->get('cid', array(), 'array');
     $cid = Joomla\Utilities\ArrayHelper::toInteger($cid);
     $urlId = $app->getUserState("url.id");
     $redirectData = array("view" => "url", "layout" => "edit", "id" => $urlId);
     if (!$cid) {
         $this->displayWarning(JText::_("COM_ITPMETA_ERROR_INVALID_ITEMS"), $redirectData);
         return;
     }
     try {
         $model = $this->getModel();
         $model->delete($cid);
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_ITPMETA_ERROR_SYSTEM'));
     }
     $msg = JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid));
     $this->displayMessage($msg, $redirectData);
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:33,代码来源:tags.php

示例14: publish

 public function publish()
 {
     // Check for request forgeries
     JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     // Get items to publish from the request.
     $id = JFactory::getApplication()->input->getInt('id', 0);
     $data = array('publish' => 1, 'unpublish' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (!$id) {
         JLog::add(JText::_('COM_DJCATALOG2_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         $cid = array($id);
         JArrayHelper::toInteger($cid);
         // Publish the items.
         if (!$model->publish($cid, $value)) {
             JLog::add($model->getError(), JLog::WARNING, 'jerror');
         } else {
             if ($value == 1) {
                 $ntext = 'COM_DJCATALOG2_ITEM_PUBLISHED';
             } else {
                 $ntext = 'COM_DJCATALOG2_ITEM_UNPUBLISHED';
             }
             $this->setMessage(JText::_($ntext));
         }
     }
     $this->setRedirect(JRoute::_(DJCatalogHelperRoute::getMyItemsRoute(), false));
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:32,代码来源:myitems.php

示例15: save

 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $data = $this->input->post->get('jform', array(), 'array');
     $itemId = Joomla\Utilities\ArrayHelper::getValue($data, 'id');
     $redirectData = array('task' => $this->getTask(), 'id' => $itemId);
     $model = $this->getModel();
     /** @var $model SocialCommunityModelLocation */
     $form = $model->getForm($data, false);
     /** @var $form JForm */
     if (!$form) {
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_FORM_CANNOT_BE_LOADED'));
     }
     // Validate the form
     $validData = $model->validate($form, $data);
     // Check for errors
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectData);
         return;
     }
     try {
         $itemId = $model->save($validData);
         $redirectData['id'] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_('COM_SOCIALCOMMUNITY_LOCATION_SAVED'), $redirectData);
 }
开发者ID:ITPrism,项目名称:SocialCommunityDistribution,代码行数:29,代码来源:location.php


注:本文中的JLog::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。