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


PHP JText::plural方法代码示例

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


在下文中一共展示了JText::plural方法的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: doExecute

 /**
  * Method to run this controller.
  *
  * @throws \InvalidArgumentException
  * @return  mixed
  */
 protected function doExecute()
 {
     if (empty($this->cid)) {
         $this->setRedirect($this->getFailRedirect(), \JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'), Message::ERROR_RED);
         return false;
     }
     $pks = $this->cid;
     foreach ($pks as $i => $pk) {
         $this->table->reset();
         if (!$this->table->load($pk)) {
             continue;
         }
         $data = $this->table->getProperties(true);
         if (!$this->allowEdit($data)) {
             $this->addMessage(\JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'));
             continue;
         }
         try {
             $this->table->checkIn($pk);
         } catch (\Exception $e) {
             $this->addMessage($this->table->getError());
         }
     }
     $message = \JText::plural($this->textPrefix . '_N_ITEMS_CHECKED_IN', count($pks));
     $this->setRedirect($this->getSuccessRedirect(), $message, Message::MESSAGE_GREEN);
     return true;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:33,代码来源:CheckinController.php

示例3: copy

 /**
  * Deep Copy projects
  *
  * @return void
  */
 public function copy()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (empty($cid)) {
         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
         JArrayHelper::toInteger($cid);
         // Copy the items.
         try {
             if ($model->copy($cid)) {
                 $this->setMessage(JText::plural('COM_TRACKS_PROJECTS_N_ITEMS_COPIED', count($cid)));
             } else {
                 $this->setMessage($model->getError(), 'error');
             }
         } catch (Exception $e) {
             $this->setMessage($e->getMessage(), 'error');
         }
     }
     $extension = $this->input->get('extension');
     $extensionURL = $extension ? '&extension=' . $extension : '';
     // Set redirect
     $this->setRedirect($this->getRedirectToListRoute($extensionURL));
 }
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:34,代码来源:projects.php

示例4: delete

 /**
  * Removes an item.
  *
  * @return  void
  */
 function delete()
 {
     $app = JFactory::getApplication();
     $map = $app->input->getVar('map');
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = $app->input->getVar('cid', array(), '', 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } 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());
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=com_mapfrance&view=areas&map=' . $map, false));
 }
开发者ID:steevo,项目名称:mapfrance,代码行数:30,代码来源:areas.php

示例5: changevalue

 public function changevalue()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to change the values from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     $data = array('showinsubscribers' => 1, 'hideinsubscribers' => 0, 'setrequired' => 1, 'unsetrequired' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         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
         JArrayHelper::toInteger($cid);
         // Change value of the items.
         try {
             $model->changevalue($cid, $value, $task);
             if ($value == 1) {
                 $ntext = $this->text_prefix . '_N_ITEMS_' . strtoupper($task);
             } elseif ($value == 0) {
                 $ntext = $this->text_prefix . '_N_ITEMS_' . strtoupper($task);
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         } catch (Exception $e) {
             $this->setMessage(JText::_('JLIB_DATABASE_ERROR_ANCESTOR_NODES_LOWER_STATE'), 'error');
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
开发者ID:JozefAB,项目名称:qk,代码行数:31,代码来源:fields.php

示例6: repliesLabel

 static function repliesLabel($replies = 0, $activity = null)
 {
     static $format = null;
     if (is_null($format)) {
         $params = JComponentHelper::getParams('com_projectfork');
         $format = $params->get('date_format');
         if (!$format) {
             $format = JText::_('DATE_FORMAT_LC1');
         }
     }
     $html = array();
     $text = JText::plural('COM_PROJECTFORK_N_REPLIES', (int) $replies);
     if ($replies == 0) {
         $html[] = '<span class="label">' . $text . '</span>';
     } else {
         $title = '';
         $class = '';
         $style = '';
         if ($activity && $activity != JFactory::getDbo()->getNullDate()) {
             $title = ' title="' . PFDate::relative($activity) . '::' . JHtml::_('date', $activity, $format) . '"';
             $style = ' style="cursor: help"';
             $class = ' hasTip';
         }
         $html[] = '<span class="label label-success' . $class . '"' . $title . $style . '>' . $text . '</span>';
     }
     return implode('', $html);
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:27,代码来源:pfforum.php

示例7: sticky_publish

 /**
  * @since	1.6
  */
 public function sticky_publish()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_NTRIP_NO_ALBUMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Change the state of the records.
         if (!$model->stick($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = 'COM_NTRIP_N_ALBUMS_STUCK';
             } else {
                 $ntext = 'COM_NTRIP_N_ALBUMS_UNSTUCK';
             }
             $this->setMessage(JText::plural($ntext, count($ids)));
         }
     }
     $this->setRedirect('index.php?option=com_jnt_hanhphuc&view=albums');
 }
开发者ID:ngxuanmui,项目名称:hp3,代码行数:32,代码来源:albums.php

示例8: required

 public function required()
 {
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $cid = $app->input->get('cid', array(), 'array');
     $data = array('required' => 1, 'unrequired' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_('COM_JUDIRECTORY_NO_ITEM_SELECTED'));
     } else {
         $model = $this->getModel();
         JArrayHelper::toInteger($cid);
         if (!$model->required($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = $this->text_prefix . '_N_ITEMS_REQUIRED';
             } elseif ($value == 0) {
                 $ntext = $this->text_prefix . '_N_ITEMS_UNREQUIRED';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $extension = $app->input->get('extension');
     $extensionURL = $extension ? '&extension=' . $extension : '';
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $extensionURL, false));
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:28,代码来源:criterias.php

示例9: changeBlock

 /**
  * Method to change the block status on a record.
  *
  * @return  void
  *
  * @since   0.3.0
  */
 public function changeBlock()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $ids = $this->input->get('cid', array(), 'array');
     $values = array('block' => 1, 'unblock' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Convert from customer ID to Joomla user ID
     $joomlaUserIds = array();
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/tables', 'SolidresTable');
     $customerTable = JTable::getInstance('Customer', 'SolidresTable');
     foreach ($ids as $id) {
         $customerTable->load($id);
         $joomlaUserIds[] = $customerTable->user_id;
     }
     if (empty($joomlaUserIds)) {
         JError::raiseWarning(500, JText::_('SR_CUSTOMERS_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models', 'UsersModel');
         $model = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true));
         // Change the state of the records.
         if (!$model->block($joomlaUserIds, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $this->setMessage(JText::plural('SR_N_CUSTOMERS_BLOCKED', count($joomlaUserIds)));
             } elseif ($value == 0) {
                 $this->setMessage(JText::plural('SR_N_CUSTOMERS_UNBLOCKED', count($joomlaUserIds)));
             }
         }
     }
     $this->setRedirect('index.php?option=com_solidres&view=customers');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:42,代码来源:customers.php

示例10: publish

 /**
  * Method to publish records.
  *
  * @return void
  *
  * @since 3.0
  */
 public function publish()
 {
     $client = JFactory::getApplication()->input->get('client', '', 'STRING');
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     $data = array('publish' => 1, 'unpublish' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     // Get some variables from the request
     if (empty($cid)) {
         JLog::add(JText::_('COM_TJFIELDS_NO_REGION_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Publish the items.
         try {
             $model->publish($cid, $value);
             if ($value === 1) {
                 $ntext = 'COM_TJFIELDS_N_REGIONS_PUBLISHED';
             } elseif ($value === 0) {
                 $ntext = 'COM_TJFIELDS_N_REGIONS_UNPUBLISHED';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         } catch (Exception $e) {
             $this->setMessage($e->getMessage(), 'error');
         }
     }
     $this->setRedirect('index.php?option=com_tjfields&view=regions&client=' . $client);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:37,代码来源:regions.php

示例11: doExecute

 /**
  * Method to run this controller.
  *
  * @throws \InvalidArgumentException
  * @return  mixed
  */
 protected function doExecute()
 {
     if (empty($this->cid)) {
         throw new \InvalidArgumentException(\JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'), 500);
     }
     $pks = $this->cid;
     foreach ($pks as $i => $pk) {
         $this->table->reset();
         if (!$this->table->load($pk)) {
             continue;
         }
         $data = $this->table->getProperties(true);
         if (!$this->allowEdit($data)) {
             $this->setMessage(\JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'));
             continue;
         }
         try {
             $this->table->checkIn($pk);
         } catch (\Exception $e) {
             $this->setMessage($this->table->getError());
         }
     }
     $message = \JText::plural($this->textPrefix . '_N_ITEMS_CHECKED_IN', count($pks));
     $this->redirectToList($message);
     return true;
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:32,代码来源:CheckinController.php

示例12: import

 public function import()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to import from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $data = JRequest::getVar('import', array(), '', 'array');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Import the items.
         if (!$model->import($cid, $data)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             $ntext = $this->text_prefix . '_N_ITEMS_IMPORTED';
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $extension = JRequest::getCmd('extension');
     $extensionURL = $extension ? '&extension=' . JRequest::getCmd('extension') : '';
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $extensionURL, false));
 }
开发者ID:MrJookie,项目名称:pm,代码行数:26,代码来源:import.php

示例13: cartable

 public function cartable()
 {
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     $data = array('cartable' => 1, 'notcartable' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     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->cartable($cid, $value)) {
             if ($value == 1) {
                 $ntext = $this->text_prefix . '_N_ITEMS_CARTABLE';
             } else {
                 $ntext = $this->text_prefix . '_N_ITEMS_NOTCARTABLE';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=com_eventgallery&view=events', false));
 }
开发者ID:sansandeep143,项目名称:av,代码行数:28,代码来源:events.php

示例14: create

 public function create()
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     // Get form data
     $pks = $app->input->post->get('cid', array(), 'array');
     $model = $this->getModel("Profile", "SocialCommunityModel");
     /** @var $model SocialCommunityModelProfile */
     $redirectOptions = array("view" => $this->view_list);
     JArrayHelper::toInteger($pks);
     // Check for validation errors.
     if (empty($pks)) {
         $this->displayWarning(JText::_("COM_SOCIALCOMMUNITY_INVALID_ITEM"), $redirectOptions);
         return;
     }
     try {
         $pks = $model->filterProfiles($pks);
         if (!$pks) {
             $this->displayWarning(JText::_("COM_SOCIALCOMMUNITY_INVALID_ITEM"), $redirectOptions);
             return;
         }
         $model->create($pks);
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::plural('COM_SOCIALCOMMUNITY_N_PROFILES_CREATED', count($pks)), $redirectOptions);
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:29,代码来源:profiles.php

示例15: delete

 /**
  * Method to remove a record.
  */
 public function delete()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JInvalid_Token'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     if (!JFactory::getUser()->authorise('core.admin', $this->option)) {
         JError::raiseError(500, JText::_('JERROR_ALERTNOAUTHOR'));
         jexit();
     } elseif (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_USERS_NO_LEVELS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         JArrayHelper::toInteger($ids);
         // Remove the items.
         if (!$model->delete($ids)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             $this->setMessage(JText::plural('COM_USERS_N_LEVELS_DELETED', count($ids)));
         }
     }
     $this->setRedirect('index.php?option=com_users&view=levels');
 }
开发者ID:exntu,项目名称:joomla-cms,代码行数:28,代码来源:level.php


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