本文整理汇总了PHP中OX_Translation::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP OX_Translation::translate方法的具体用法?PHP OX_Translation::translate怎么用?PHP OX_Translation::translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OX_Translation
的用法示例。
在下文中一共展示了OX_Translation::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildAgencyForm
function buildAgencyForm($aAgency)
{
$form = new OA_Admin_UI_Component_Form("agencyform", "POST", $_SERVER['SCRIPT_NAME']);
$form->forceClientValidation(true);
$form->addElement('hidden', 'agencyid', $aAgency['agencyid']);
$form->addElement('header', 'header_basic', $GLOBALS['strBasicInformation']);
$form->addElement('text', 'name', $GLOBALS['strName']);
$form->addElement('text', 'contact', $GLOBALS['strContact']);
$form->addElement('text', 'email', $GLOBALS['strEMail']);
//we want submit to be the last element in its own separate section
$form->addElement('controls', 'form-controls');
$form->addElement('submit', 'submit', $GLOBALS['strSaveChanges']);
//Form validation rules
$translation = new OX_Translation();
$nameRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strName']));
$form->addRule('name', $nameRequiredMsg, 'required');
$contactRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strContact']));
$form->addRule('contact', $contactRequiredMsg, 'required');
$emailRequiredMsg = $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strEMail']));
$form->addRule('email', $emailRequiredMsg, 'required');
$form->addRule('email', $GLOBALS['strEmailField'], 'email');
//set form values
$form->setDefaults($aAgency);
return $form;
}
示例2: buildForm
/**
* Append type-specific form elements to the base form
*
* @param object form
* @param integer banner id
*/
function buildForm(&$form, &$row)
{
$form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)");
$header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner'] . " - banner code");
$header->setAttribute('icon', 'icon-banner-html.gif');
$form->addElement($header);
$adPlugins = OX_Component::getComponents('3rdPartyServers');
$adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName');
$adPluginsList = array();
$adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric'];
$adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml'];
foreach ($adPluginsNames as $adPluginKey => $adPluginName) {
$adPluginsList[$adPluginKey] = $adPluginName;
}
$htmlG['textarea'] = $form->createElement('textarea', 'htmltemplate', null, array('class' => 'code', 'cols' => '45', 'rows' => '10', 'wrap' => 'off', 'dir' => 'ltr', 'style' => 'width:550px;'));
$aSelectAttributes = array('id' => 'adserver', 'style' => 'margin-left: 15px;width:230px');
$htmlG['select'] = HTML_QuickForm::createElement('select', 'adserver', $GLOBALS['strAlterHTML'], $adPluginsList, $aSelectAttributes);
$form->addGroup($htmlG, 'html_banner_g', null, array("<br>", ""), false);
$form->addElement('header', 'header_b_links', "Banner link");
$form->addElement('text', 'url', $GLOBALS['strURL']);
$form->addElement('text', 'target', $GLOBALS['strTarget']);
$form->addElement('header', 'header_b_display', 'Banner display');
$sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":");
$sizeG['width']->setSize(5);
$sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":");
$sizeG['height']->setSize(5);
if (!empty($row['bannerid'])) {
$sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
$sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
}
$form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false);
$form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier());
//validation rules
$translation = new OX_Translation();
$widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required');
$heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required');
$numericRule = array($GLOBALS['strNumericField'], 'numeric');
$form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule), 'height' => array($heightRequiredRule, $numericRule)));
}
示例3: testPluginTranslationByPlainString
function testPluginTranslationByPlainString()
{
$transPath = '/tests/data/_lang';
$GLOBALS['_MAX']['PREF']['language'] = 'en';
$oTrans = new OX_Translation($transPath);
// Make sure the translation resource loaded correctly
$this->assertNotNull($oTrans->zTrans);
// Translation by "key"
$result = $oTrans->translate('TestString');
$expected = 'This is a test string';
$this->assertEqual($expected, $result);
// Translation by "string"
$expected = 'This is the translation of "another string"';
$result = $oTrans->translate('This is another test string');
$this->assertEqual($expected, $result);
// Translation of not-present "string/key"
$expected = 'This string doesn\'t exist in the source po file';
$result = $oTrans->translate('This string doesn\'t exist in the source po file');
$this->assertEqual($expected, $result);
// Translation of a translated string that contains substitutions
$expected = 'This is a test frog with a 3 number in it';
$result = $oTrans->translate('This is a test %s with a %d number in it', array('frog', 3));
$this->assertEqual($expected, $result);
}
示例4: foreach
$aPublisherList = Admin_DA::getPublishers(array('agency_id' => $agencyId));
}
$aPublisher[0] = $GLOBALS['strSelectPublisher'];
foreach ($aPublisherList as $key => $aValue) {
$aPublisher[$aValue['publisher_id']] = $aValue['name'];
}
if (!empty($publisherId)) {
$zone = Admin_DA::getZones(array('publisher_id' => $publisherId));
$aZone[0] = $GLOBALS['strSelectZone'];
foreach ($zone as $key => $aValue) {
$aZone[$aValue['zone_id']] = $aValue['name'];
}
}
}
$oTrans = new OX_Translation();
$aParams = array('order' => $orderdirection, 'listorder' => $listorder, 'start_date' => $startDate, 'end_date' => $endDate, 'prevImg' => '<< ' . $oTrans->translate('Back'), 'nextImg' => $oTrans->translate('Next') . ' >>');
// Only pass advertiser or website props if we show related checkboxes
if ($showAdvertisers) {
$aParams['advertiser_id'] = $advertiserId;
$aParams['campaign_id'] = $campaignId;
}
if ($showPublishers) {
$aParams['publisher_id'] = $publisherId;
$aParams['zone_id'] = $zoneId;
}
// Account security
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$aParams['account_id'] = OA_Permission::getAccountId();
}
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$aParams['advertiser_account_id'] = OA_Permission::getAccountId();
示例5: getName
/**
* Returns a translated name of this section
*
* @return unknown
*/
function getName()
{
return $this->oTranslation->translate($this->nameKey);
}
示例6: handlePost
function handlePost($vars)
{
$codes = array();
if (isset($vars['tag']) && is_array($vars['tag'])) {
foreach ($vars['tag'] as $k => $v) {
$codes[$k] = array('tagcode' => stripslashes($v), 'paused' => false);
$codes[$k]['autotrack'] = isset($vars['autotrack'][$k]);
}
}
if (isset($vars['t_paused'])) {
foreach (explode(',', $vars['t_paused']) as $k) {
if (isset($codes[$k])) {
$codes[$k]['paused'] = true;
}
}
}
if (isset($vars['t_action'])) {
switch ($vars['t_action']) {
case 'new':
$codes[] = array('tagcode' => '', 'paused' => false);
break;
case 'del':
if (isset($vars['t_id']) && isset($codes[$vars['t_id']])) {
unset($codes[$vars['t_id']]);
}
break;
case 'up':
if (isset($vars['t_id']) && isset($codes[$vars['t_id']]) && isset($codes[$vars['t_id'] - 1])) {
$tmp = $codes[$vars['t_id']];
$codes[$vars['t_id']] = $codes[$vars['t_id'] - 1];
$codes[$vars['t_id'] - 1] = $tmp;
}
break;
case 'down':
if (isset($vars['t_id']) && isset($codes[$vars['t_id']]) && isset($codes[$vars['t_id'] + 1])) {
$tmp = $codes[$vars['t_id']];
$codes[$vars['t_id']] = $codes[$vars['t_id'] + 1];
$codes[$vars['t_id'] + 1] = $tmp;
}
break;
case 'pause':
case 'restart':
if (isset($vars['t_id']) && isset($codes[$vars['t_id']])) {
$codes[$vars['t_id']]['paused'] = $vars['t_action'] == 'pause';
}
break;
}
}
if (isset($vars['save'])) {
$this->_dal->setAppendCodes($this->tracker_id, $codes);
// Queue confirmation message
$doTrackers = OA_Dal::factoryDO('trackers');
$doTrackers->get($this->tracker_id);
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strTrackerAppendHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $this->advertiser_id . "&trackerid=" . $this->tracker_id), htmlspecialchars($doTrackers->trackername)));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect("tracker-append.php?clientid={$this->advertiser_id}&trackerid={$this->tracker_id}");
} else {
$this->codes = $codes;
$this->showReminder = true;
}
}
示例7: array
$doTrackers->update();
// Queue confirmation message
$trackerName = $doTrackers->trackername;
$doClients = OA_Dal::factoryDO('clients');
if ($doClients->get($moveto)) {
$advertiserName = $doClients->clientname;
}
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strTrackerHasBeenMoved'], array(htmlspecialchars($trackerName), htmlspecialchars($advertiserName)));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
}
Header("Location: " . $returnurl . "?clientid=" . $moveto . "&trackerid=" . $trackerid);
exit;
} elseif (isset($duplicate) && $duplicate == 'true') {
$doTrackers = OA_Dal::factoryDO('trackers');
if ($doTrackers->get($trackerid)) {
$oldName = $doTrackers->trackername;
$new_trackerid = $doTrackers->duplicate();
if ($doTrackers->get($new_trackerid)) {
$newName = $doTrackers->trackername;
}
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strTrackerHasBeenDuplicated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid={$clientid}&trackerid={$trackerid}"), htmlspecialchars($oldName), MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid={$clientid}&trackerid={$new_trackerid}"), htmlspecialchars($newName)));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
Header("Location: " . $returnurl . "?clientid=" . $clientid . "&trackerid=" . $new_trackerid);
exit;
}
}
}
Header("Location: " . $returnurl . "?clientid=" . $clientid . "&trackerid=" . $trackerid);
示例8: substr
function _function_ox_tracker_type($aParams, &$smarty)
{
if (isset($aParams['type'])) {
$type = $aParams['type'];
$type = $GLOBALS['_MAX']['CONN_TYPES'][$type];
// Warning: $type contains the id of translation string... remove 'str' to be able to pass it on to OX_Translation
$type = substr($type, 3);
$translation = new OX_Translation();
return $translation->translate($type);
} else {
$smarty->trigger_error("t: missing 'type' parameter");
}
}
示例9: processForm
function processForm($form)
{
$aFields = $form->exportValues();
// If ID is not set, it should be a null-value for the auto_increment
if (empty($aFields['trackerid'])) {
$aFields['trackerid'] = "null";
}
$doTrackers = OA_Dal::factoryDO('trackers');
$doTrackers->trackername = $aFields['trackername'];
$doTrackers->description = $aFields['description'];
$doTrackers->status = $aFields['status'];
$doTrackers->type = $aFields['type'];
$doTrackers->linkcampaigns = $aFields['linkcampaigns'] == "t" ? "t" : "f";
$doTrackers->clientid = $aFields['clientid'];
if (empty($aFields['trackerid']) || $aFields['trackerid'] == "null") {
$aFields['trackerid'] = $doTrackers->insert();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strTrackerHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $aFields['clientid'] . "&trackerid=" . $aFields['trackerid']), htmlspecialchars($aFields['trackername'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect('advertiser-trackers.php?clientid=' . $aFields['clientid']);
} else {
$doTrackers->trackerid = $aFields['trackerid'];
$doTrackers->update();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strTrackerHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "tracker-edit.php?clientid=" . $aFields['clientid'] . "&trackerid=" . $aFields['trackerid']), htmlspecialchars($aFields['trackername'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect("tracker-edit.php?clientid=" . $aFields['clientid'] . "&trackerid=" . $aFields['trackerid']);
}
exit;
}
示例10: array
if (isset($trackerids) && is_array($trackerids)) {
for ($i = 0; $i < sizeof($trackerids); $i++) {
$aFields = array('campaignid', 'trackerid', 'status');
$values = array($campaignid, $trackerids[$i], $statusids[$i]);
$fieldsSize = count($aFields);
$doCampaigns_trackers = OA_Dal::factoryDO('campaigns_trackers');
for ($k = 0; $k < $fieldsSize; $k++) {
$field = $aFields[$k];
$doCampaigns_trackers->{$field} = $values[$k];
}
$doCampaigns_trackers->insert();
}
}
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strCampaignTrackersHaveBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "campaign-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid), htmlspecialchars($doCampaigns->campaignname)));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect("campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $campaignid);
}
}
/*-------------------------------------------------------*/
/* HTML framework */
/*-------------------------------------------------------*/
if (!isset($listorder)) {
if (isset($session['prefs']['campaign-trackers.php']['listorder'])) {
$listorder = $session['prefs']['campaign-trackers.php']['listorder'];
} else {
$listorder = '';
}
}
if (!isset($orderdirection)) {
示例11: explode
if (!empty($campaignid)) {
$ids = explode(',', $campaignid);
while (list(, $campaignid) = each($ids)) {
// Security check
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
$doCampaigns = OA_Dal::factoryDO('campaigns');
$doCampaigns->campaignid = $campaignid;
if ($doCampaigns->get($campaignid)) {
$aCampaign = $doCampaigns->toArray();
}
$doCampaigns->delete();
}
// Queue confirmation message
$translation = new OX_Translation();
if (count($ids) == 1) {
$translated_message = $translation->translate($GLOBALS['strCampaignHasBeenDeleted'], array(htmlspecialchars($aCampaign['campaignname'])));
} else {
$translated_message = $translation->translate($GLOBALS['strCampaignsHaveBeenDeleted']);
}
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
}
// Run the Maintenance Priority Engine process
OA_Maintenance_Priority::scheduleRun();
// Rebuild cache
// include_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
// phpAds_cacheDelete();
/*-------------------------------------------------------*/
/* Return to the index page */
/*-------------------------------------------------------*/
if (empty($returnurl)) {
$returnurl = 'advertiser-campaigns.php';
示例12: processForm
function processForm($aAdvertiser, $form)
{
$aFields = $form->exportValues();
// Name
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$aAdvertiser['clientname'] = $aFields['clientname'];
}
// Default fields
$aAdvertiser['contact'] = $aFields['contact'];
$aAdvertiser['email'] = $aFields['email'];
$aAdvertiser['comments'] = $aFields['comments'];
// Same advertiser limitation
$aAdvertiser['advertiser_limitation'] = $aFields['advertiser_limitation'] == '1' ? 1 : 0;
// Reports
$aAdvertiser['report'] = $aFields['report'] == 't' ? 't' : 'f';
$aAdvertiser['reportdeactivate'] = $aFields['reportdeactivate'] == 't' ? 't' : 'f';
$aAdvertiser['reportinterval'] = (int) $aFields['reportinterval'];
if ($aAdvertiser['reportinterval'] == 0) {
$aAdvertiser['reportinterval'] = 1;
}
if ($aFields['reportlastdate'] == '' || $aFields['reportlastdate'] == '0000-00-00' || $aFields['reportprevious'] != $aAdvertiser['report']) {
$aAdvertiser['reportlastdate'] = date("Y-m-d");
}
if (empty($aAdvertiser['clientid'])) {
// Set agency ID
$aAdvertiser['agencyid'] = OA_Permission::getAgencyId();
$doClients = OA_Dal::factoryDO('clients');
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
// Insert
$aAdvertiser['clientid'] = $doClients->insert();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname']), MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aAdvertiser['clientid'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// Go to next page
OX_Admin_Redirect::redirect("advertiser-index.php");
} else {
$doClients = OA_Dal::factoryDO('clients');
$doClients->get($aAdvertiser['clientid']);
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
$doClients->update();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect('advertiser-edit.php?clientid=' . $aAdvertiser['clientid']);
}
exit;
}
示例13: explode
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
if (!empty($bannerid)) {
$ids = explode(',', $bannerid);
while (list(, $bannerid) = each($ids)) {
$doBanners = OA_Dal::factoryDO('banners');
$doBanners->bannerid = $bannerid;
if ($doBanners->get($bannerid)) {
$aBanner = $doBanners->toArray();
}
$doBanners->delete();
}
// Queue confirmation message
$translation = new OX_Translation();
if (count($ids) == 1) {
$translated_message = $translation->translate($GLOBALS['strBannerHasBeenDeleted'], array(htmlspecialchars($aBanner['description'])));
} else {
$translated_message = $translation->translate($GLOBALS['strBannersHaveBeenDeleted']);
}
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
}
// Run the Maintenance Priority Engine process
OA_Maintenance_Priority::scheduleRun();
// Rebuild cache
// include_once MAX_PATH . '/lib/max/deliverycache/cache-'.$conf['delivery']['cache'].'.inc.php';
// phpAds_cacheDelete();
if (empty($returnurl)) {
$returnurl = 'campaign-banners.php';
}
header("Location: " . $returnurl . "?clientid=" . $clientid . "&campaignid=" . $campaignid);
示例14: array
$value = OA_ENTITY_STATUS_RUNNING;
}
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
OA_Permission::enforceAccessToObject('banners', $bannerid, true);
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
if ($value == OA_ENTITY_STATUS_RUNNING) {
OA_Permission::enforceAllowed(OA_PERM_BANNER_ACTIVATE);
} else {
OA_Permission::enforceAllowed(OA_PERM_BANNER_DEACTIVATE);
}
}
if (!empty($bannerid)) {
$doBanners = OA_Dal::factoryDO('banners');
$doBanners->get($bannerid);
$bannerName = $doBanners->description;
$translation = new OX_Translation();
$message = $value == OA_ENTITY_STATUS_PAUSED ? $GLOBALS['strBannerHasBeenDeactivated'] : $GLOBALS['strBannerHasBeenActivated'];
$translated_message = $translation->translate($message, array("banner-edit.php?clientid={$clientid}&campaignid={$campaignid}&bannerid={$bannerid}", htmlspecialchars($bannerName)));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
$doBanners->status = $value;
$doBanners->update();
} elseif (!empty($campaignid)) {
$doBanners = OA_Dal::factoryDO('banners');
$doBanners->status = $value;
$doBanners->whereAdd('campaignid = ' . $campaignid);
$doBanners->update(DB_DATAOBJECT_WHEREADD_ONLY);
}
OA_Maintenance_Priority::scheduleRun();
header("Location: oxMarkedTextAdvertiser-index.php?clientid=" . $clientid . "&campaignid=" . $campaignid);
示例15: checkIfCampaignTypeSpecified
function checkIfCampaignTypeSpecified($submitValues)
{
if (empty($submitValues['campaign_type'])) {
$translation = new OX_Translation();
return array('g_ctype' => $translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strCampaignType'])));
}
return true;
}