本文整理汇总了PHP中Backend\Core\Engine\Language::msg方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::msg方法的具体用法?PHP Language::msg怎么用?PHP Language::msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend\Core\Engine\Language
的用法示例。
在下文中一共展示了Language::msg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$categoryTitle = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($categoryTitle === '') {
$this->output(self::BAD_REQUEST, null, BL::err('TitleIsRequired'));
} else {
// get the data
// build array
$item['title'] = \SpoonFilter::htmlspecialchars($categoryTitle);
$item['language'] = BL::getWorkingLanguage();
$meta['keywords'] = $item['title'];
$meta['keywords_overwrite'] = 'N';
$meta['description'] = $item['title'];
$meta['description_overwrite'] = 'N';
$meta['title'] = $item['title'];
$meta['title_overwrite'] = 'N';
$meta['url'] = BackendBlogModel::getURLForCategory(\SpoonFilter::urlise($item['title']));
// update
$item['id'] = BackendBlogModel::insertCategory($item, $meta);
// output
$this->output(self::OK, $item, vsprintf(BL::msg('AddedCategory'), array($item['title'])));
}
}
示例2: loadDatagrids
/**
* Loads the dataGrids
*/
private function loadDatagrids()
{
// load all categories
$categories = BackendFaqModel::getCategories(true);
// loop categories and create a dataGrid for each one
foreach ($categories as $categoryId => $categoryTitle) {
$dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
$dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop'));
$dataGrid->setColumnsHidden(array('category_id', 'sequence'));
$dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>');
$dataGrid->setColumnsSequence('dragAndDropHandle');
$dataGrid->setColumnAttributes('question', array('class' => 'title'));
$dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle'));
$dataGrid->setRowAttributes(array('id' => '[id]'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('Edit')) {
$dataGrid->setColumnURL('question', BackendModel::createURLForAction('Edit') . '&id=[id]');
$dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]', BL::lbl('Edit'));
}
// add dataGrid to list
$this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
}
// set empty datagrid
$this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => '')));
$this->emptyDatagrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop emptyGrid'));
$this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
}
示例3: addProductData
/**
* Add productdata into the comment
*
* @param string $text The comment.
* @param string $title The title for the product.
* @param string $URL The URL for the product.
* @param int $id The id of the comment.
* @return string
*/
public static function addProductData($text, $title, $URL, $id)
{
// reset URL
$URL = BackendModel::getURLForBlock('Catalog', 'Detail') . '/' . $URL . '#comment-' . $id;
// build HTML
return '<p><em>' . sprintf(BL::msg('CommentOnWithURL'), $URL, $title) . '</em></p>' . "\n" . (string) $text;
}
示例4: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$id = \SpoonFilter::getPostValue('id', null, 0, 'int');
$tag = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
// validate id
if ($id === 0) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
} else {
// validate tag name
if ($tag === '') {
$this->output(self::BAD_REQUEST, null, BL::err('NameIsRequired'));
} else {
// check if tag exists
if (BackendTagsModel::existsTag($tag)) {
$this->output(self::BAD_REQUEST, null, BL::err('TagAlreadyExists'));
} else {
$item['id'] = $id;
$item['tag'] = \SpoonFilter::htmlspecialchars($tag);
$item['url'] = BackendTagsModel::getURL(CommonUri::getUrl(\SpoonFilter::htmlspecialcharsDecode($item['tag'])), $id);
BackendTagsModel::update($item);
$this->output(self::OK, $item, vsprintf(BL::msg('Edited'), array($item['tag'])));
}
}
}
}
示例5: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$id = \SpoonFilter::getPostValue('id', null, '', 'int');
$name = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($name == '') {
$this->output(self::BAD_REQUEST, null, 'no name provided');
} else {
// get existing id
$existingId = BackendMailmotorModel::getCampaignId($name);
// validate
if ($existingId !== 0 && $id !== $existingId) {
$this->output(self::ERROR, array('id' => $existingId, 'error' => true), BL::err('CampaignExists', $this->getModule()));
} else {
// build array
$item = array();
$item['id'] = $id;
$item['name'] = $name;
$item['created_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
// get page
$rows = BackendMailmotorModel::updateCampaign($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'edited_campaign', array('item' => $item));
// output
if ($rows !== 0) {
$this->output(self::OK, array('id' => $id), BL::msg('CampaignEdited', $this->getModule()));
} else {
$this->output(self::ERROR, null, BL::err('CampaignNotEdited', $this->getModule()));
}
}
}
}
示例6: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$url = \SpoonFilter::getPostValue('url', null, '');
$username = \SpoonFilter::getPostValue('username', null, '');
$password = \SpoonFilter::getPostValue('password', null, '');
// filter out the 'http://' from the URL
if (strpos($url, 'http://') !== false) {
$url = str_replace('http://', '', $url);
}
if (strpos($url, 'https://') !== false) {
$url = str_replace('https://', '', $url);
}
// init validation
$errors = array();
// validate input
if (empty($url)) {
$errors['url'] = BL::err('NoCMAccountCredentials');
}
if (empty($username)) {
$errors['username'] = BL::err('NoCMAccountCredentials');
}
if (empty($password)) {
$errors['password'] = BL::err('NoCMAccountCredentials');
}
// got errors
if (!empty($errors)) {
$this->output(self::OK, array('errors' => $errors), 'form contains errors');
} else {
try {
// check if the CampaignMonitor class exists
if (!is_file(PATH_LIBRARY . '/external/campaignmonitor.php')) {
throw new \Exception(BL::err('ClassDoesNotExist'));
}
// require CampaignMonitor class
require_once PATH_LIBRARY . '/external/campaignmonitor.php';
// init CampaignMonitor object
new \CampaignMonitor($url, $username, $password, 10);
// save the new data
$this->get('fork.settings')->set($this->getModule(), 'cm_url', $url);
$this->get('fork.settings')->set($this->getModule(), 'cm_username', $username);
$this->get('fork.settings')->set($this->getModule(), 'cm_password', $password);
// account was linked
$this->get('fork.settings')->set($this->getModule(), 'cm_account', true);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_account_linked');
// CM was successfully initialized
$this->output(self::OK, array('message' => 'account-linked'), BL::msg('AccountLinked', $this->getModule()));
} catch (\Exception $e) {
// timeout occurred
if ($e->getMessage() == 'Error Fetching http headers') {
$this->output(self::BAD_REQUEST, null, BL::err('CmTimeout', $this->getModule()));
}
// other error
$this->output(self::ERROR, array('field' => 'url'), sprintf(BL::err('CampaignMonitorError', $this->getModule()), $e->getMessage()));
}
}
}
示例7: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$newSequence = \SpoonFilter::getPostValue('new_sequence', null, '');
// validate
if ($newSequence == '') {
$this->output(self::BAD_REQUEST, null, 'no new_sequence provided');
} else {
// convert into array
$json = @json_decode($newSequence, true);
// validate
if ($json === false) {
$this->output(self::BAD_REQUEST, null, 'invalid new_sequence provided');
} else {
// initialize
$userSequence = array();
$hiddenItems = array();
// loop columns
foreach ($json as $column => $widgets) {
$columnValue = 'left';
if ($column == 1) {
$columnValue = 'middle';
} elseif ($column == 2) {
$columnValue = 'right';
}
// loop widgets
foreach ($widgets as $sequence => $widget) {
// store position
$userSequence[$widget['module']][$widget['widget']] = array('column' => $columnValue, 'position' => $sequence, 'hidden' => $widget['hidden'], 'present' => $widget['present']);
// add to array
if ($widget['hidden']) {
$hiddenItems[] = $widget['module'] . '_' . $widget['widget'];
}
}
}
// get previous setting
$currentSetting = BackendAuthentication::getUser()->getSetting('dashboard_sequence');
$data['reload'] = false;
// any settings?
if ($currentSetting !== null) {
// loop modules
foreach ($currentSetting as $module => $widgets) {
foreach ($widgets as $widget => $values) {
if ($values['hidden'] && isset($userSequence[$module][$widget]['hidden']) && !$userSequence[$module][$widget]['hidden']) {
$data['reload'] = true;
}
}
}
}
// store
BackendAuthentication::getUser()->setSetting('dashboard_sequence', $userSequence);
// output
$this->output(self::OK, $data, BL::msg('Saved'));
}
}
}
示例8: loadForm
/**
* Load the form
*/
private function loadForm()
{
// create form
$this->frm = new BackendForm('edit');
// add "no default group" option for radiobuttons
$chkDefaultForLanguageValues[] = array('label' => BL::msg('NoDefault'), 'value' => '0');
// set default for language radiobutton values
foreach (BL::getWorkingLanguages() as $key => $value) {
$chkDefaultForLanguageValues[] = array('label' => $value, 'value' => $key);
}
// create elements
$this->frm->addText('name', $this->record['name']);
$this->frm->addRadiobutton('default', $chkDefaultForLanguageValues, $this->record['language']);
}
示例9: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
//--Set post var to check submit
$_POST["form"] = "add_image";
// get parameters
$this->id = \SpoonFilter::getPostValue('id', null, '', 'int');
//--Load form
$this->loadForm();
//--Validate form
$this->validateForm();
// output
$this->output(self::OK, null, BL::msg('Success'));
}
示例10: validateForm
/**
* Validates the form
*/
private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// no errors ?
if ($this->frm->isCorrect()) {
// smtp settings
$this->get('fork.settings')->set('Core', 'seo_noodp', $this->frm->getField('seo_noodp')->getValue());
$this->get('fork.settings')->set('Core', 'seo_noydir', $this->frm->getField('seo_noydir')->getValue());
$this->get('fork.settings')->set('Core', 'seo_nofollow_in_comments', $this->frm->getField('seo_nofollow_in_comments')->getValue());
// assign report
$this->tpl->assign('report', true);
$this->tpl->assign('reportMessage', BL::msg('Saved'));
}
}
}
示例11: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$id = \SpoonFilter::getPostValue('id', null, '', 'int');
// validate
if ($id == '' || !BackendMailmotorModel::existsMailing($id)) {
$this->output(self::BAD_REQUEST, null, 'No mailing found.');
} else {
// get mailing record
$mailing = BackendMailmotorModel::getMailing($id);
/*
mailing was already sent
We use a custom status code 900 because we want to do more with JS than triggering an error
*/
if ($mailing['status'] == 'sent') {
$this->output(500, null, BL::err('MailingAlreadySent', $this->getModule()));
} else {
// make a regular date out of the send_on timestamp
$mailing['delivery_date'] = date('Y-m-d H:i:s', $mailing['send_on']);
// send the mailing
try {
// only update the mailing if it was queued
if ($mailing['status'] == 'queued') {
BackendMailmotorCMHelper::updateMailing($mailing);
} else {
// send the mailing if it wasn't queued
BackendMailmotorCMHelper::sendMailing($mailing);
}
} catch (\Exception $e) {
// stop the script and show our error
$this->output(500, null, $e->getMessage());
return;
}
// set status to 'sent'
$item['id'] = $id;
$item['status'] = $mailing['send_on'] > time() ? 'queued' : 'sent';
// update the mailing record
BackendMailmotorModel::updateMailing($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_mailing_status_' . $item['status'], array('item' => $item));
// we made it \o/
$this->output(self::OK, array('mailing_id' => $item['id']), BL::msg('MailingSent', $this->getModule()));
}
}
}
示例12: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
$generalSettings = $this->get('fork.settings')->getForModule('Location');
// get parameters
$itemId = \SpoonFilter::getPostValue('id', null, null, 'int');
$zoomLevel = trim(\SpoonFilter::getPostValue('zoom', null, 'auto'));
$mapType = strtoupper(trim(\SpoonFilter::getPostValue('type', array('roadmap', 'satelitte', 'hybrid', 'terrain'), 'roadmap')));
$centerLat = \SpoonFilter::getPostValue('centerLat', null, 1, 'float');
$centerlng = \SpoonFilter::getPostValue('centerLng', null, 1, 'float');
$height = \SpoonFilter::getPostValue('height', null, $generalSettings['height'], 'int');
$width = \SpoonFilter::getPostValue('width', null, $generalSettings['width'], 'int');
$showLink = \SpoonFilter::getPostValue('link', array('true', 'false'), 'false', 'string');
$showDirections = \SpoonFilter::getPostValue('directions', array('true', 'false'), 'false', 'string');
$showOverview = \SpoonFilter::getPostValue('showOverview', array('true', 'false'), 'true', 'string');
// reformat
$center = array('lat' => $centerLat, 'lng' => $centerlng);
$showLink = $showLink == 'true';
$showDirections = $showDirections == 'true';
$showOverview = $showOverview == 'true';
// standard dimensions
if ($width > 800) {
$width = 800;
}
if ($width < 300) {
$width = $generalSettings['width'];
}
if ($height < 150) {
$height = $generalSettings['height'];
}
// no id given, this means we should update the main map
BackendLocationModel::setMapSetting($itemId, 'zoom_level', (string) $zoomLevel);
BackendLocationModel::setMapSetting($itemId, 'map_type', (string) $mapType);
BackendLocationModel::setMapSetting($itemId, 'center', (array) $center);
BackendLocationModel::setMapSetting($itemId, 'height', (int) $height);
BackendLocationModel::setMapSetting($itemId, 'width', (int) $width);
BackendLocationModel::setMapSetting($itemId, 'directions', $showDirections);
BackendLocationModel::setMapSetting($itemId, 'full_url', $showLink);
$item = array('id' => $itemId, 'language' => BL::getWorkingLanguage(), 'show_overview' => $showOverview ? 'Y' : 'N');
BackendLocationModel::update($item);
// output
$this->output(self::OK, null, BL::msg('Success'));
}
示例13: 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') . '&module=[raw_name]');
$this->dataGridInstallableModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('DetailModule') . '&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') . '&module=[raw_name]', BL::lbl('Install'));
$this->dataGridInstallableModules->setColumnConfirm('install', sprintf(BL::msg('ConfirmModuleInstall'), '[raw_name]'), null, \SpoonFilter::ucfirst(BL::lbl('Install')) . '?');
}
}
示例14: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$mailingId = \SpoonFilter::getPostValue('mailing_id', null, '', 'int');
$sendOnDate = \SpoonFilter::getPostValue('send_on_date', null, BackendModel::getUTCDate('d/m/Y'));
$sendOnTime = \SpoonFilter::getPostValue('send_on_time', null, BackendModel::getUTCDate('H:i'));
$messageDate = $sendOnDate;
// validate mailing ID
if ($mailingId == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid mailing ID');
} else {
// validate date & time
if ($sendOnDate == '' || $sendOnTime == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid send date date provided');
} else {
// record is empty
if (!BackendMailmotorModel::existsMailing($mailingId)) {
$this->output(self::BAD_REQUEST, null, BL::err('MailingDoesNotExist', $this->getModule()));
} else {
// reverse the date and make it a proper
$explodedDate = explode('/', $sendOnDate);
$sendOnDate = $explodedDate[2] . '-' . $explodedDate[1] . '-' . $explodedDate[0];
// calc full send timestamp
$sendTimestamp = strtotime($sendOnDate . ' ' . $sendOnTime);
// build data
$item['id'] = $mailingId;
$item['send_on'] = BackendModel::getUTCDate('Y-m-d H:i:s', $sendTimestamp);
$item['edited_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
// update mailing
BackendMailmotorModel::updateMailing($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_edit_mailing_step4', array('item' => $item));
// output
$this->output(self::OK, array('mailing_id' => $mailingId, 'timestamp' => $sendTimestamp), sprintf(BL::msg('SendOn', $this->getModule()), $messageDate, $sendOnTime));
}
}
}
}
示例15: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
$fromEmail = \SpoonFilter::getPostValue('mailer_from_email', null, '');
$fromName = \SpoonFilter::getPostValue('mailer_from_name', null, '');
$toEmail = \SpoonFilter::getPostValue('mailer_to_email', null, '');
$toName = \SpoonFilter::getPostValue('mailer_to_name', null, '');
$replyToEmail = \SpoonFilter::getPostValue('mailer_reply_to_email', null, '');
$replyToName = \SpoonFilter::getPostValue('mailer_reply_to_name', null, '');
// init validation
$errors = array();
// validate
if ($fromEmail == '' || !\SpoonFilter::isEmail($fromEmail)) {
$errors['from'] = BL::err('EmailIsInvalid');
}
if ($toEmail == '' || !\SpoonFilter::isEmail($toEmail)) {
$errors['to'] = BL::err('EmailIsInvalid');
}
if ($replyToEmail == '' || !\SpoonFilter::isEmail($replyToEmail)) {
$errors['reply'] = BL::err('EmailIsInvalid');
}
// got errors?
if (!empty($errors)) {
$this->output(self::BAD_REQUEST, array('errors' => $errors), 'invalid fields');
} else {
$message = \Swift_Message::newInstance('Test')->setFrom(array($fromEmail => $fromName))->setTo(array($toEmail => $toName))->setReplyTo(array($replyToEmail => $replyToName))->setBody(BL::msg('TestMessage'), 'text/plain');
$transport = \Common\Mailer\TransportFactory::create(\SpoonFilter::getPostValue('mailer_type', array('smtp', 'mail'), 'mail'), \SpoonFilter::getPostValue('smtp_server', null, ''), \SpoonFilter::getPostValue('smtp_port', null, ''), \SpoonFilter::getPostValue('smtp_username', null, ''), \SpoonFilter::getPostValue('smtp_password', null, ''), \SpoonFilter::getPostValue('smtp_secure_layer', null, ''));
$mailer = \Swift_Mailer::newInstance($transport);
try {
if ($mailer->send($message)) {
$this->output(self::OK, null, '');
} else {
$this->output(self::ERROR, null, 'unknown');
}
} catch (\Exception $e) {
$this->output(self::ERROR, null, $e->getMessage());
}
}
}