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


PHP Language::getLabel方法代码示例

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


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

示例1: calculateTimeAgo

 /**
  * Calculate time ago.
  *
  * @param int $timestamp Unix timestamp from the past.
  * @return string
  */
 public static function calculateTimeAgo($timestamp)
 {
     $secondsBetween = time() - $timestamp;
     // calculate
     $hours = floor($secondsBetween / (60 * 60));
     $minutes = floor($secondsBetween / 60);
     $seconds = floor($secondsBetween);
     // today start
     $todayStart = (int) strtotime(date('d F Y'));
     // today
     if ($timestamp >= $todayStart) {
         // today
         if ($hours >= 1) {
             return BL::getLabel('Today') . ' ' . date('H:i', $timestamp);
         } elseif ($minutes > 1) {
             // more than one minute
             return sprintf(BL::getLabel('MinutesAgo'), $minutes);
         } elseif ($minutes == 1) {
             // one minute
             return BL::getLabel('OneMinuteAgo');
         } elseif ($seconds > 1) {
             // more than one second
             return sprintf(BL::getLabel('SecondsAgo'), $seconds);
         } elseif ($seconds <= 1) {
             // one second
             return BL::getLabel('OneSecondAgo');
         }
     } elseif ($timestamp < $todayStart && $timestamp >= $todayStart - 86400) {
         // yesterday
         return BL::getLabel('Yesterday') . ' ' . date('H:i', $timestamp);
     } else {
         // older
         return date('d/m/Y H:i', $timestamp);
     }
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:41,代码来源:Model.php

示例2: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     // gender dropdown values
     $genderValues = array('male' => \SpoonFilter::ucfirst(BL::getLabel('Male')), 'female' => \SpoonFilter::ucfirst(BL::getLabel('Female')));
     // birthdate dropdown values
     $days = range(1, 31);
     $months = \SpoonLocale::getMonths(BL::getInterfaceLanguage());
     $years = range(date('Y'), 1900);
     // create form
     $this->frm = new BackendForm('add');
     // create elements
     $this->frm->addText('email');
     $this->frm->addPassword('password');
     $this->frm->addText('display_name');
     $this->frm->addText('first_name');
     $this->frm->addText('last_name');
     $this->frm->addText('city');
     $this->frm->addDropdown('gender', $genderValues);
     $this->frm->addDropdown('day', array_combine($days, $days));
     $this->frm->addDropdown('month', $months);
     $this->frm->addDropdown('year', array_combine($years, $years));
     $this->frm->addDropdown('country', Intl::getRegionBundle()->getCountryNames(BL::getInterfaceLanguage()));
     // set default elements dropdowns
     $this->frm->getField('gender')->setDefaultElement('');
     $this->frm->getField('day')->setDefaultElement('');
     $this->frm->getField('month')->setDefaultElement('');
     $this->frm->getField('year')->setDefaultElement('');
     $this->frm->getField('country')->setDefaultElement('');
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:32,代码来源:Add.php

示例3: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->imageIsAllowed = $this->get('fork.settings')->get($this->URL->getModule(), 'show_image_form', true);
     $this->frm = new BackendForm('add');
     // set hidden values
     $rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y');
     $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
     // get categories
     $categories = BackendBlogModel::getCategories();
     $categories['new_category'] = \SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
     // create elements
     $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title');
     $this->frm->addEditor('text');
     $this->frm->addEditor('introduction');
     $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
     $this->frm->addCheckbox('allow_comments', $this->get('fork.settings')->get($this->getModule(), 'allow_comments', false));
     $this->frm->addDropdown('category_id', $categories, \SpoonFilter::getGetValue('category', null, null, 'int'));
     if (count($categories) != 2) {
         $this->frm->getField('category_id')->setDefaultElement('');
     }
     $this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), BackendAuthentication::getUser()->getUserId());
     $this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox');
     $this->frm->addDate('publish_on_date');
     $this->frm->addTime('publish_on_time');
     if ($this->imageIsAllowed) {
         $this->frm->addImage('image');
     }
     // meta
     $this->meta = new BackendMeta($this->frm, null, 'title', true);
 }
开发者ID:newaltcoin,项目名称:forkcms,代码行数:33,代码来源:Add.php

示例4: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->frm = new BackendForm('add');
     $this->frm->addText('name');
     $this->frm->addDropdown('method', array('database' => BL::getLabel('MethodDatabase'), 'database_email' => BL::getLabel('MethodDatabaseEmail')), 'database_email');
     $this->frm->addText('email');
     $this->frm->addText('identifier', BackendFormBuilderModel::createIdentifier());
     $this->frm->addEditor('success_message');
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:12,代码来源:Add.php

示例5: setClickableCount

 /**
  * Convert the count in a human readable one.
  *
  * @param int $count The count.
  * @param string $link The link for the count.
  * @return string
  */
 public static function setClickableCount($count, $link)
 {
     $count = (int) $count;
     $link = (string) $link;
     $return = '';
     if ($count > 1) {
         $return = '<a href="' . $link . '">' . $count . ' ' . BL::getLabel('Articles') . '</a>';
     } elseif ($count == 1) {
         $return = '<a href="' . $link . '">' . $count . ' ' . BL::getLabel('Article') . '</a>';
     }
     return $return;
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:19,代码来源:Categories.php

示例6: loadDataGrid

 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendFormBuilderModel::QRY_BROWSE, BL::getWorkingLanguage());
     $this->dataGrid->setHeaderLabels(array('email' => \SpoonFilter::ucfirst(BL::getLabel('Recipient')), 'sent_forms' => ''));
     $this->dataGrid->setSortingColumns(array('name', 'email', 'method', 'sent_forms'), 'name');
     $this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'formatRecipients'), array('[email]'), 'email');
     $this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'getLocale'), array('Method_[method]'), 'method');
     $this->dataGrid->setColumnFunction(array(__CLASS__, 'parseNumForms'), array('[id]', '[sent_forms]'), 'sent_forms');
     // check if edit action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
         $this->dataGrid->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]', BL::getLabel('Edit'));
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:17,代码来源:Index.php

示例7: loadDataGridInstallable

 /**
  * Load the data grid for installable modules.
  */
 private function loadDataGridInstallable()
 {
     // create datagrid
     $this->dataGridInstallableModules = new BackendDataGridArray($this->installableModules);
     $this->dataGridInstallableModules->setSortingColumns(array('raw_name'));
     $this->dataGridInstallableModules->setHeaderLabels(array('raw_name' => \SpoonFilter::ucfirst(BL::getLabel('Name'))));
     $this->dataGridInstallableModules->setColumnsHidden(array('installed', 'name', 'cronjobs_active'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('DetailModule')) {
         $this->dataGridInstallableModules->setColumnURL('raw_name', BackendModel::createURLForAction('DetailModule') . '&amp;module=[raw_name]');
         $this->dataGridInstallableModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('DetailModule') . '&amp;module=[raw_name]', BL::lbl('Details'));
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('InstallModule')) {
         // add install column
         $this->dataGridInstallableModules->addColumn('install', null, BL::lbl('Install'), BackendModel::createURLForAction('InstallModule') . '&amp;module=[raw_name]', BL::lbl('Install'));
         $this->dataGridInstallableModules->setColumnConfirm('install', sprintf(BL::msg('ConfirmModuleInstall'), '[raw_name]'), null, \SpoonFilter::ucfirst(BL::lbl('Install')) . '?');
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:22,代码来源:Modules.php

示例8: loadDataGridCronjobs

 /**
  * Load the data grid which contains the cronjobs.
  */
 private function loadDataGridCronjobs()
 {
     // no cronjobs = don't bother
     if (!isset($this->information['cronjobs'])) {
         return;
     }
     // create data grid
     $this->dataGridCronjobs = new BackendDataGridArray($this->information['cronjobs']);
     // hide columns
     $this->dataGridCronjobs->setColumnsHidden(array('minute', 'hour', 'day-of-month', 'month', 'day-of-week', 'action', 'description', 'active'));
     // add cronjob data column
     $this->dataGridCronjobs->addColumn('cronjob', BL::getLabel('Cronjob'), '[description]<br /><strong>[minute] [hour] [day-of-month] [month] [day-of-week]</strong> php ' . PATH_WWW . '/backend/cronjob module=<strong>' . $this->currentModule . '</strong> action=<strong>[action]</strong>', null, null, null, 0);
     // no paging
     $this->dataGridCronjobs->setPaging(false);
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:18,代码来源:DetailModule.php

示例9: updateCategory

 /**
  * Update a certain category
  *
  * @param array $item
  */
 public static function updateCategory(array $item)
 {
     $item['edited_on'] = BackendModel::getUTCDate();
     BackendModel::getContainer()->get('database')->update('catalog_categories', $item, 'id = ?', array($item['id']));
     // update extra
     BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => BL::getLabel('Category') . ' ' . $item['title'], 'language' => $item['language'], 'edit_url' => BackendModel::createURLForAction('EditCategory') . '&id=' . $item['id']));
 }
开发者ID:Comsa-Veurne,项目名称:modules,代码行数:12,代码来源:Model.php

示例10: loadGroups

 /**
  * Load the data grid with groups.
  */
 private function loadGroups()
 {
     // create the data grid
     $this->dgGroups = new BackendDataGridDB(BackendProfilesModel::QRY_DATAGRID_BROWSE_PROFILE_GROUPS, array($this->profile['id']));
     // sorting columns
     $this->dgGroups->setSortingColumns(array('group_name'), 'group_name');
     // disable paging
     $this->dgGroups->setPaging(false);
     // set column function
     $this->dgGroups->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[expires_on]'), 'expires_on', true);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditProfileGroup')) {
         // set column URLs
         $this->dgGroups->setColumnURL('group_name', BackendModel::createURLForAction('EditProfileGroup') . '&amp;id=[id]&amp;profile_id=' . $this->id);
         // edit column
         $this->dgGroups->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('EditProfileGroup') . '&amp;id=[id]&amp;profile_id=' . $this->id, BL::getLabel('Edit'));
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:21,代码来源:Edit.php

示例11: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('edit');
     // set hidden values
     $rbtHiddenValues[] = array('label' => BL::lbl('Hidden'), 'value' => 'Y');
     $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
     // get categories
     $categories = BackendBlogModel::getCategories();
     $categories['new_category'] = \SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
     // create elements
     $this->frm->addText('title', $this->record['title'], null, 'inputText title', 'inputTextError title');
     $this->frm->addEditor('text', $this->record['text']);
     $this->frm->addEditor('introduction', $this->record['introduction']);
     $this->frm->addRadiobutton('hidden', $rbtHiddenValues, $this->record['hidden']);
     $this->frm->addCheckbox('allow_comments', $this->record['allow_comments'] === 'Y' ? true : false);
     $this->frm->addDropdown('category_id', $categories, $this->record['category_id']);
     if (count($categories) != 2) {
         $this->frm->getField('category_id')->setDefaultElement('');
     }
     $this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), $this->record['user_id']);
     $this->frm->addText('tags', BackendTagsModel::getTags($this->URL->getModule(), $this->record['id']), null, 'inputText tagBox', 'inputTextError tagBox');
     $this->frm->addDate('publish_on_date', $this->record['publish_on']);
     $this->frm->addTime('publish_on_time', date('H:i', $this->record['publish_on']));
     if ($this->imageIsAllowed) {
         $this->frm->addImage('image');
         $this->frm->addCheckbox('delete_image');
     }
     // meta object
     $this->meta = new BackendMeta($this->frm, $this->record['meta_id'], 'title', true);
     // set callback for generating a unique URL
     $this->meta->setUrlCallback('Backend\\Modules\\Blog\\Engine\\Model', 'getURL', array($this->record['id']));
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:36,代码来源:Edit.php

示例12: loadForm

 /**
  * Add all element into the form
  */
 protected function loadForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         /**
          * If the fields are disabled we don't have any values in the post.
          * When an error occurs in the other fields of the form the meta-fields would be cleared
          * therefore we alter the POST so it contains the initial values.
          */
         if (!isset($_POST['page_title'])) {
             $_POST['page_title'] = isset($this->data['title']) ? $this->data['title'] : null;
         }
         if (!isset($_POST['meta_description'])) {
             $_POST['meta_description'] = isset($this->data['description']) ? $this->data['description'] : null;
         }
         if (!isset($_POST['meta_keywords'])) {
             $_POST['meta_keywords'] = isset($this->data['keywords']) ? $this->data['keywords'] : null;
         }
         if (!isset($_POST['url'])) {
             $_POST['url'] = isset($this->data['url']) ? $this->data['url'] : null;
         }
         if ($this->custom && !isset($_POST['meta_custom'])) {
             $_POST['meta_custom'] = isset($this->data['custom']) ? $this->data['custom'] : null;
         }
         if (!isset($_POST['seo_index'])) {
             $_POST['seo_index'] = isset($this->data['data']['seo_index']) ? $this->data['data']['seo_index'] : 'none';
         }
         if (!isset($_POST['seo_follow'])) {
             $_POST['seo_follow'] = isset($this->data['data']['seo_follow']) ? $this->data['data']['seo_follow'] : 'none';
         }
     }
     // add page title elements into the form
     $this->frm->addCheckbox('page_title_overwrite', isset($this->data['title_overwrite']) && $this->data['title_overwrite'] == 'Y');
     $this->frm->addText('page_title', isset($this->data['title']) ? $this->data['title'] : null);
     // add meta description elements into the form
     $this->frm->addCheckbox('meta_description_overwrite', isset($this->data['description_overwrite']) && $this->data['description_overwrite'] == 'Y');
     $this->frm->addText('meta_description', isset($this->data['description']) ? $this->data['description'] : null);
     // add meta keywords elements into the form
     $this->frm->addCheckbox('meta_keywords_overwrite', isset($this->data['keywords_overwrite']) && $this->data['keywords_overwrite'] == 'Y');
     $this->frm->addText('meta_keywords', isset($this->data['keywords']) ? $this->data['keywords'] : null);
     // add URL elements into the form
     $this->frm->addCheckbox('url_overwrite', isset($this->data['url_overwrite']) && $this->data['url_overwrite'] == 'Y');
     $this->frm->addText('url', isset($this->data['url']) ? urldecode($this->data['url']) : null);
     // advanced SEO
     $indexValues = array(array('value' => 'none', 'label' => Language::getLabel('None')), array('value' => 'index', 'label' => 'index'), array('value' => 'noindex', 'label' => 'noindex'));
     $this->frm->addRadiobutton('seo_index', $indexValues, isset($this->data['data']['seo_index']) ? $this->data['data']['seo_index'] : 'none');
     $followValues = array(array('value' => 'none', 'label' => Language::getLabel('None')), array('value' => 'follow', 'label' => 'follow'), array('value' => 'nofollow', 'label' => 'nofollow'));
     $this->frm->addRadiobutton('seo_follow', $followValues, isset($this->data['data']['seo_follow']) ? $this->data['data']['seo_follow'] : 'none');
     // should we add the meta-custom field
     if ($this->custom) {
         // add meta custom element into the form
         $this->frm->addTextarea('meta_custom', isset($this->data['custom']) ? $this->data['custom'] : null);
     }
     $this->frm->addHidden('meta_id', $this->id);
     $this->frm->addHidden('base_field_name', $this->baseFieldName);
     $this->frm->addHidden('custom', $this->custom);
     $this->frm->addHidden('class_name', $this->callback['class']);
     $this->frm->addHidden('method_name', $this->callback['method']);
     $this->frm->addHidden('parameters', \SpoonFilter::htmlspecialchars(serialize($this->callback['parameters'])));
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:63,代码来源:Meta.php

示例13: loadDataGrid

 /**
  * Load the datagrid
  */
 private function loadDataGrid()
 {
     // fetch query and parameters
     list($query, $parameters) = $this->buildQuery();
     // create datagrid
     $this->dgProfiles = new BackendDataGridDB($query, $parameters);
     // overrule default URL
     $this->dgProfiles->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'email' => $this->filter['email'], 'status' => $this->filter['status'], 'group' => $this->filter['group']), false));
     // sorting columns
     $this->dgProfiles->setSortingColumns(array('email', 'display_name', 'status', 'registered_on'), 'email');
     // set column function
     $this->dgProfiles->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[registered_on]'), 'registered_on', true);
     // add the mass action controls
     $this->dgProfiles->setMassActionCheckboxes('checkbox', '[id]');
     $ddmMassAction = new \SpoonFormDropdown('action', array('addToGroup' => BL::getLabel('AddToGroup'), 'delete' => BL::getLabel('Delete')), 'addToGroup');
     $ddmMassAction->setAttribute('id', 'massAction');
     $ddmMassAction->setOptionAttributes('addToGroup', array('data-message-id' => 'confirmAddToGroup'));
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDelete'));
     $this->dgProfiles->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         // set column URLs
         $this->dgProfiles->setColumnURL('email', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
         // add columns
         $this->dgProfiles->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('Edit', null, null, null) . '&amp;id=[id]', BL::getLabel('Edit'));
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:30,代码来源:Index.php

示例14: loadDataGrid

 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     list($query, $parameters) = $this->buildQuery();
     // create datagrid
     $this->dataGrid = new BackendDataGridDB($query, $parameters);
     // overrule default URL
     $this->dataGrid->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date']), false) . '&amp;id=' . $this->id);
     // sorting columns
     $this->dataGrid->setSortingColumns(array('sent_on'), 'sent_on');
     $this->dataGrid->setSortParameter('desc');
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('DataDetails')) {
         // set colum URLs
         $this->dataGrid->setColumnURL('sent_on', BackendModel::createURLForAction('DataDetails', null, null, array('start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date']), false) . '&amp;id=[id]');
         // add edit column
         $this->dataGrid->addColumn('details', null, BL::getLabel('Details'), BackendModel::createURLForAction('DataDetails', null, null, array('start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date'])) . '&amp;id=[id]', BL::getLabel('Details'));
     }
     // date
     $this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'calculateTimeAgo'), '[sent_on]', 'sent_on', false);
     $this->dataGrid->setColumnFunction('ucfirst', '[sent_on]', 'sent_on', false);
     // add the multicheckbox column
     $this->dataGrid->setMassActionCheckboxes('checkbox', '[id]');
     // mass action
     $ddmMassAction = new \SpoonFormDropdown('action', array('delete' => BL::getLabel('Delete')), 'delete');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDelete'));
     $this->dataGrid->setMassAction($ddmMassAction);
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:30,代码来源:Data.php

示例15: updateCategory

 /**
  * Update a certain category
  *
  * @param array $item
  */
 public static function updateCategory(array $item)
 {
     $item['edited_on'] = BackendModel::getUTCDate();
     BackendModel::get('database')->update('blocks_categories', $item, 'id = ?', array($item['id']));
     // build array
     $extra['data'] = serialize(array('language' => Language::getWorkingLanguage(), 'extra_label' => 'Block ' . Language::getLabel('Category') . ' ' . $item['title'], 'id' => $item['id']));
     // update extra
     BackendModel::get('database')->update('modules_extras', $extra, 'id= ?', array($item['extra_id']));
 }
开发者ID:Comsa-Veurne,项目名称:modules,代码行数:14,代码来源:Model.php


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