本文整理汇总了PHP中BL::msg方法的典型用法代码示例。如果您正苦于以下问题:PHP BL::msg方法的具体用法?PHP BL::msg怎么用?PHP BL::msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BL
的用法示例。
在下文中一共展示了BL::msg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadDataGrid
/**
* Loads the datagrid with the clicked link
*/
private function loadDataGrid()
{
// no statistics found
if (empty($this->statistics['clicked_links'])) {
return false;
}
// map urlencode to clicked links stack
$this->statistics['clicked_links'] = SpoonFilter::arrayMapRecursive('urlencode', $this->statistics['clicked_links']);
// create a new source-object
$source = new SpoonDataGridSourceArray($this->statistics['clicked_links']);
// call the parent, as in create a new datagrid with the created source
$this->dataGrid = new BackendDataGrid($source);
$this->dataGrid->setURL(BackendModel::createURLForAction() . '&offset=[offset]&order=[order]&sort=[sort]&id=' . $this->id);
// set headers values
$headers['link'] = strtoupper(BL::lbl('URL'));
$headers['clicks'] = SpoonFilter::ucfirst(BL::msg('ClicksAmount'));
// set headers
$this->dataGrid->setHeaderLabels($headers);
// sorting columns
$this->dataGrid->setSortingColumns(array('link', 'clicks'), 'link');
// set colunn functions
$this->dataGrid->setColumnFunction('urldecode', array('[link]'), 'link', true);
$this->dataGrid->setColumnFunction('urldecode', array('[link]'), 'link', true);
// set paging limit
$this->dataGrid->setPagingLimit(self::PAGING_LIMIT);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('statistics_link')) {
// add edit column
$this->dataGrid->addColumnAction('users', null, BL::lbl('Who'), BackendModel::createURLForAction('statistics_link') . '&url=[link]&mailing_id=' . $this->id, BL::lbl('Who'));
}
}
示例2: addPostData
/**
* Add postdata into the comment
*
* @return string
* @param string $text The comment.
* @param string $title The title for the blogarticle.
* @param string $URL The URL for the blogarticle.
* @param int $id The id of the comment.
*/
public static function addPostData($text, $title, $URL, $id)
{
// reset URL
$URL = BackendModel::getURLForBlock('blog', 'detail') . '/' . $URL . '#comment-' . $id;
// build HTML
return '<p><em>' . sprintf(BL::msg('CommentOnWithURL'), $URL, $title) . '</em></p>' . "\n" . (string) $text;
}
示例3: 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');
}
if ($sendOnDate == '' || $sendOnTime == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid send date date provided');
}
// record is empty
if (!BackendMailmotorModel::existsMailing($mailingId)) {
$this->output(self::BAD_REQUEST, null, BL::err('MailingDoesNotExist', 'mailmotor'));
}
// 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));
}
示例4: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$id = SpoonFilter::getPostValue('id', null, 0, 'int');
$tag = trim(SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($id === 0) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
}
if ($tag === '') {
$this->output(self::BAD_REQUEST, null, BL::err('NameIsRequired'));
}
// check if tag exists
if (BackendTagsModel::existsTag($tag)) {
$this->output(self::BAD_REQUEST, null, BL::err('TagAlreadyExists'));
}
// build array
$item['id'] = $id;
$item['tag'] = SpoonFilter::htmlspecialchars($tag);
$item['url'] = BackendTagsModel::getURL($item['tag'], $id);
// update
BackendTagsModel::update($item);
// output
$this->output(self::OK, $item, vsprintf(BL::msg('Edited'), array($item['tag'])));
}
示例5: 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));
}
示例6: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
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');
}
// get existing id
$existingId = BackendMailmotorModel::getCampaignId($name);
// existing campaign
if ($existingId !== 0 && $id !== $existingId) {
$this->output(self::ERROR, array('id' => $existingId, 'error' => true), BL::err('CampaignExists', $this->getModule()));
}
// 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()));
}
}
示例7: 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'));
}
// 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'])));
}
示例8: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$newSequence = SpoonFilter::getPostValue('new_sequence', null, '');
// validate
if ($newSequence == '') {
$this->output(self::BAD_REQUEST, null, 'no new_sequence provided');
}
// convert into array
$json = @json_decode($newSequence, true);
// validate
if ($json === false) {
$this->output(self::BAD_REQUEST, null, 'invalid new_sequence provided');
}
// initialize
$userSequence = array();
$hiddenItems = array();
// loop columns
foreach ($json as $column => $widgets) {
$columnValue = 'left';
if ($column == 1) {
$columnValue = 'middle';
}
if ($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'));
}
示例9: 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);
}
// check input
if (empty($url)) {
$this->output(self::BAD_REQUEST, array('field' => 'url'), BL::err('NoCMAccountCredentials'));
}
if (empty($username)) {
$this->output(self::BAD_REQUEST, array('field' => 'username'), BL::err('NoCMAccountCredentials'));
}
if (empty($password)) {
$this->output(self::BAD_REQUEST, array('field' => 'password'), BL::err('NoCMAccountCredentials'));
}
try {
// check if the CampaignMonitor class exists
if (!SpoonFile::exists(PATH_LIBRARY . '/external/campaignmonitor.php')) {
// the class doesn't exist, so stop here
$this->output(self::BAD_REQUEST, null, BL::err('ClassDoesNotExist', $this->getModule()));
}
// require CampaignMonitor class
require_once 'external/campaignmonitor.php';
// init CampaignMonitor object
new CampaignMonitor($url, $username, $password, 10);
// save the new data
BackendModel::setModuleSetting($this->getModule(), 'cm_url', $url);
BackendModel::setModuleSetting($this->getModule(), 'cm_username', $username);
BackendModel::setModuleSetting($this->getModule(), 'cm_password', $password);
// account was linked
BackendModel::setModuleSetting($this->getModule(), 'cm_account', true);
} catch (Exception $e) {
// timeout occured
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()));
}
// 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()));
}
示例10: parseReferrers
/**
* Parse into template
*/
private function parseReferrers()
{
$results = BackendAnalyticsModel::getRecentReferrers();
if (!empty($results)) {
$dataGrid = new BackendDataGridArray($results);
$dataGrid->setPaging();
$dataGrid->setColumnsHidden('id', 'date', 'url');
$dataGrid->setColumnURL('referrer', '[url]');
}
// parse the datagrid
return !empty($results) ? $dataGrid->getContent() : '<table class="dataGrid"><tr><td>' . BL::msg('NoReferrers') . '</td></tr></table>';
}
示例11: loadForm
/**
* Load the form
*
* @return void
*/
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']);
}
示例12: validateForm
/**
* Validates the form
*
* @return void
*/
private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// no errors ?
if ($this->frm->isCorrect()) {
// smtp settings
BackendModel::setModuleSetting('core', 'seo_noodp', $this->frm->getField('seo_noodp')->getValue());
BackendModel::setModuleSetting('core', 'seo_noydir', $this->frm->getField('seo_noydir')->getValue());
BackendModel::setModuleSetting('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'));
}
}
}
示例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('detail_module')) {
$this->dataGridInstallableModules->setColumnURL('raw_name', BackendModel::createURLForAction('detail_module') . '&module=[raw_name]');
$this->dataGridInstallableModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('detail_module') . '&module=[raw_name]', BL::lbl('Details'));
}
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('install_module')) {
// add install column
$this->dataGridInstallableModules->addColumn('install', null, BL::lbl('Install'), BackendModel::createURLForAction('install_module') . '&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
$id = SpoonFilter::getPostValue('id', null, '', 'int');
// validate
if ($id == '' || !BackendMailmotorModel::existsMailing($id)) {
$this->output(self::BAD_REQUEST, null, 'No mailing found.');
}
// 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(900, null, BL::err('MailingAlreadySent', $this->getModule()));
}
// 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 {
BackendMailmotorCMHelper::sendMailing($mailing);
}
} catch (Exception $e) {
// stop the script and show our error
$this->output(902, null, $e->getMessage());
}
// 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()));
}
示例15: validateForm
/**
* Validates the form
*
* @return void
*/
private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// no errors?
if ($this->frm->isCorrect()) {
// determine themes
$newTheme = $this->frm->getField('theme')->getValue();
$oldTheme = BackendModel::getModuleSetting('core', 'theme', 'core');
// check if we actually switched themes
if ($newTheme != $oldTheme) {
// fetch templates
$oldTemplates = BackendPagesModel::getTemplates($oldTheme);
$newTemplates = BackendPagesModel::getTemplates($newTheme);
// check if templates already exist
if (empty($newTemplates)) {
// templates do not yet exist; don't switch
$this->redirect(BackendModel::createURLForAction('themes') . '&error=no-templates-available');
exit;
}
// fetch current default template
$oldDefaultTemplatePath = $oldTemplates[BackendModel::getModuleSetting('pages', 'default_template')]['path'];
// loop new templates
foreach ($newTemplates as $newTemplateId => $newTemplate) {
// check if a a similar default template exists
if ($newTemplate['path'] == $oldDefaultTemplatePath) {
// set new default id
$newDefaultTemplateId = (int) $newTemplateId;
break;
}
}
// no default template was found, set first template as default
if (!isset($newDefaultTemplateId)) {
$newDefaultTemplateId = array_keys($newTemplates);
$newDefaultTemplateId = $newDefaultTemplateId[0];
}
// update theme
BackendModel::setModuleSetting('core', 'theme', $newTheme);
// set amount of blocks
BackendPagesModel::setMaximumBlocks();
// save new default template
BackendModel::setModuleSetting('pages', 'default_template', $newDefaultTemplateId);
// loop old templates
foreach ($oldTemplates as $oldTemplateId => $oldTemplate) {
// loop new templates
foreach ($newTemplates as $newTemplateId => $newTemplate) {
// check if we have a matching template
if ($oldTemplate['path'] == $newTemplate['path']) {
// switch template
BackendPagesModel::updatePagesTemplates($oldTemplateId, $newTemplateId);
// break loop
continue 2;
}
}
// getting here meant we found no matching template for the new theme; pick first theme's template as default
BackendPagesModel::updatePagesTemplates($oldTemplateId, $newDefaultTemplateId);
}
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_changed_theme');
}
// assign report
$this->tpl->assign('report', true);
$this->tpl->assign('reportMessage', BL::msg('Saved'));
}
}
}