本文整理汇总了PHP中Neuron_Core_Tools::putIntoText方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::putIntoText方法的具体用法?PHP Neuron_Core_Tools::putIntoText怎么用?PHP Neuron_Core_Tools::putIntoText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neuron_Core_Tools
的用法示例。
在下文中一共展示了Neuron_Core_Tools::putIntoText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
public function getContent($error = null)
{
$text = Neuron_Core_Text::__getInstance();
$text->setFile('account');
$text->setSection('premium');
$player = Neuron_GameServer::getPlayer();
if (!$player) {
return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
}
$openid = isset($_SESSION['neuron_openid_identity']) ? md5($_SESSION['neuron_openid_identity']) : false;
if ($player && $player->isFound() && ($player->isEmailCertified() || $openid)) {
$page = new Neuron_Core_Template();
// Premium account stuff
$page->set('premium', $text->get('premium', 'myAccount'));
if ($player->isPremium()) {
$page->set('premiumLast', Neuron_Core_Tools::putIntoText($text->get('premiumLast', 'myAccount'), array(date(DATETIME, $player->getPremiumEndDate()))));
$page->set('extend2', $text->getClickTo($text->get('toPremium', 'myAccount')));
} else {
$page->set('notPremium1', $text->get('notPremium', 'myAccount'));
$page->set('notPremium2', $text->getClickTo($text->get('toPremium', 'myAccount')));
}
$page->set('toUse', $text->getClickTo(Neuron_Core_Tools::putIntoText($text->get('toUseCredit'), array('amount' => PREMIUM_COST_CREDITS))));
$page->set('extend_url', htmlentities($player->getCreditUseUrl(PREMIUM_COST_CREDITS)));
$page->set('benefits', $this->getBenefits());
if (!empty($error)) {
$page->set('error', $text->get($error));
}
return $page->parse('gameserver/account/premium.tpl');
} elseif ($player->isFound()) {
return '<p>' . $text->get('validateEmail') . '</p>';
}
}
示例2: getForum
protected function getForum()
{
$requestData = $this->getRequestData();
if (isset($requestData['clan'])) {
$clan = new Dolumar_Players_Clan($requestData['clan']);
if ($clan) {
$login = Neuron_Core_Login::__getInstance();
if ($login->isLogin()) {
$me = Neuron_GameServer::getPlayer();
$isMember = $clan->isMember($me);
$isModerator = $clan->isModerator($me);
//__construct ($iForumType, $iForumId, $objUser = false, $bCanSeeAll = false, $bIsModerator = false)
$forum = new Neuron_Forum_Forum(1, $clan->getId(), $me, $isMember, $isModerator);
} else {
$forum = new Neuron_Forum_Forum(1, $clan->getId(), false, false, false);
}
// Fetch thze title
$text = Neuron_Core_Text::__getInstance();
$forum->setTitle(Neuron_Core_Tools::putIntoText($text->get('title', 'forum', 'clan'), array('clan' => Neuron_Core_Tools::output_varchar($clan->getName()))));
return $forum;
} else {
return false;
}
} else {
return false;
}
}
示例3: getDescription
public function getDescription($tags = true)
{
$this->loadData();
if ($tags) {
return Neuron_Core_Tools::putIntoText($this->data['c_description'], array('clan' => $this->getName(), 'members' => count($this->getMembers())));
} else {
return $this->data['c_description'];
}
}
示例4: getContent
public function getContent()
{
// Fetch thze model
$login = Neuron_Core_Login::__getInstance();
$text = Neuron_Core_Text::__getInstance();
if ($login->isLogin()) {
$player = Neuron_GameServer::getPlayer();
if ($player->isBanned('messages')) {
$end = $player->getBanDuration('messages');
$duration = Neuron_Core_Tools::getCountdown($end);
return '<p class="false">' . Neuron_Core_Tools::putIntoText($text->get('banned', 'messages', 'messages'), array('duration' => $duration)) . '</p>';
} elseif (!$player->isEmailVerified()) {
return '<p class="false">' . $text->get('validateEmail', 'main', 'account') . '</p>';
} else {
$objMessages = new Neuron_Structure_Messages($player);
return $objMessages->getPageHTML($this->getInputData());
}
} else {
$this->throwError($text->get('noLogin', 'main', 'main'));
}
}
示例5: getChooseUnits
private function getChooseUnits($target, $error = null)
{
$text = Neuron_Core_Text::__getInstance();
$text->setFile('battle');
$text->setSection('challenge');
$page = new Neuron_Core_Template();
$page->set('target', Neuron_Core_Tools::output_varchar($target->getName()));
$page->set('action', 'attack');
$page->set('target_id', $target->getId());
$showForm = true;
if ($target->getOwner()->equals($this->village->getOwner())) {
$page->set('error', $text->get('ownVillage'));
$showForm = false;
}
$page->set('showForm', $showForm);
foreach ($this->village->getAttackSlots($target) as $k => $v) {
$page->addListValue('slots', array('id' => $k, 'sType' => $text->get($v->getName(), 'slots', 'battle'), 'sName' => $v->getName()));
}
if (!empty($error)) {
$page->set('error', $text->get($error));
}
$page->set('challenge', Neuron_Core_Tools::putIntoText($text->get('challenge'), array(Neuron_Core_Tools::output_varchar($target->getName()))));
// Calculate distance
$afstand = Dolumar_Map_Map::getDistanceBetweenVillages($this->village, $target, false);
$page->set('distance', Neuron_Core_Tools::putIntoText($text->get('distance'), array(Neuron_Core_Tools::output_distance($afstand))));
// Make a list of available squads
$squads = $this->getSquads();
foreach ($squads as $v) {
if ($v->getUnitsAmount() > 0) {
$page->addListValue('squads', array('sName' => Neuron_Core_Tools::output_varchar($v->getName()), 'oUnits' => $v->getUnits(), 'id' => $v->getId()));
}
}
// Sort the list
$page->sortList('units');
if (isset($this->error)) {
$page->set('error', $this->error);
}
return $page->parse('battle/chooseUnits.tpl');
}
示例6: DoQuote
public function DoQuote($bbcode, $action, $name, $default, $params, $content)
{
if ($action == BBCODE_CHECK) {
return true;
}
$text = Neuron_Core_Text::getInstance();
$txtname = 'quote';
$txtparams = array();
if (isset($params['name'])) {
$txtparams['name'] = htmlspecialchars(trim($params['name']));
$txtname .= '_wrote';
if (isset($params['date'])) {
$date = strtotime($params['date']);
$txtparams['date'] = date(DATETIME, $date);
$txtname .= '_date';
}
} else {
if (!is_string($default)) {
// Do nothing
} else {
$txtparams['name'] = htmlspecialchars(trim($default));
$txtname .= '_wrote';
}
}
$title = Neuron_Core_Tools::putIntoText($text->get($txtname, 'textconvert', 'main', ""), $txtparams);
$out = "\n<blockquote class=\"bbcode_quote\">\n";
if (!empty($title)) {
$out .= "<h4 class=\"bbcode_quote_head\">" . $title . "</h4>\n";
}
$out .= "<div class=\"bbcode_quote_body\">" . $content . "</div>\n</blockquote>\n";
return $out;
}
示例7: getChooseAmount
private function getChooseAmount($target)
{
$page = new Neuron_Core_Template();
$text = Neuron_Core_Text::getInstance();
$tab = isset($this->aInput['tab']) ? $this->aInput['tab'] : 'resources';
switch ($tab) {
case 'resources':
case 'runes':
case 'equipment':
break;
default:
$tab = 'resources';
break;
}
$this->setTabUrl($page, 'resources', $target);
$this->setTabUrl($page, 'runes', $target);
$this->setTabUrl($page, 'equipment', $target);
$page->set('target', $target->getId());
$page->set('tab', $tab);
switch ($tab) {
case 'resources':
$res = $this->getVillage()->resources->getResources();
foreach ($res as $k => $v) {
$page->addListValue('resources', array('name' => $k, 'amount' => 0, 'available' => $v));
}
break;
case 'runes':
$runes = $this->getVillage()->resources->getRunes();
foreach ($runes as $k => $v) {
$page->addListValue('runes', array('name' => $k, 'amount' => 0, 'available' => $v));
}
break;
case 'equipment':
$equipment = $this->getVillage()->equipment->getEquipment();
$output = array();
foreach ($equipment as $type => $vv) {
$output[$type] = array('name' => $text->get($type, 'types', 'equipment'), 'equipment' => array());
foreach ($vv as $v) {
$output[$type]['equipment'][] = array('id' => $v->getId(), 'name' => $v->getName(true), 'amount' => 0, 'available' => $v->getAmount(), 'formid' => 'equipment_' . $v->getId());
}
}
$page->set('equipment', $output);
break;
}
$page->set('canTrade', $this->isValidTarget($target, $tab));
$page->set('tradeerror', Neuron_Core_Tools::putIntoText($text->get($this->sError, 'market', 'buildings', $this->sError), array('percentage' => self::MAX_PERCENTAGE)));
return $page->parse('buildings/market.phpt');
}
示例8: showUpgradeContent
private function showUpgradeContent($error = null, $errorA = array())
{
$text = Neuron_Core_Text::__getInstance();
$page = new Neuron_Core_Template();
$input = $this->objWindow->getInputData();
$lvl = $this->getLevel();
if (!empty($error)) {
if ($error == 'unfinished') {
$errorA = array(Neuron_Core_Tools::getCountdown(max($this->data['lastUpgradeDate'], $this->data['readyDate'])));
}
} elseif (!$this->getVillage()->readyToBuild()) {
$error = 'busy';
} elseif (!$this->isFinished()) {
$error = 'unfinished';
$errorA = array(Neuron_Core_Tools::getCountdown(max($this->data['lastUpgradeDate'], $this->data['readyDate'])));
}
if (!empty($error)) {
$txterr = Neuron_Core_Tools::putIntoText($text->get($error, 'upgradeError', 'building'), $errorA);
$jsondata = json_encode(array('page' => 'upgrade', 'queue' => 'true', 'upgrade' => 'confirm', 'runeSelection' => isset($input['runeSelection']) ? $input['runeSelection'] : null));
$page->set('error', $txterr);
$page->set('errorV', $error);
if ($error != 'done' && isset($input['upgrade'])) {
$this->objWindow->dialog($txterr, $text->get('queueUpgrade', 'queue', 'building'), 'windowAction (this, ' . $jsondata . ');', $text->get('okay', 'main', 'main'), 'void(0);');
}
}
$page->set('about', $text->get('about', 'upgrade', 'building'));
$page->set('upgrade', $text->get('upgrade', 'upgrade', 'building'));
$page->set('cost', $text->get('cost', 'upgrade', 'building'));
$page->set('duration', Neuron_Core_Tools::getDurationText($this->getUpgradeTime($this->getVillage())));
$page->set('info', $this->getUpgradeInformation());
$page->set('upgradeAll', Neuron_Core_Tools::putIntoText($text->get('upgradeAll', 'upgrade', 'building'), array($this->getName(true))));
$page->set('upgradeLink', Neuron_Core_Tools::putIntoText($text->get('startUpgrade', 'upgrade', 'building'), array($this->getName(true), $lvl + 1)));
$upgrade = $this->getUpgradeCost_text($this->getVillage(), true);
$page->set('upgradeCost', $upgrade);
$page->set('back', $text->getClickTo($text->get('back', 'building', 'building')));
return $page->parse('buildings/general_upgrade.tpl');
}
示例9: processInput
public function processInput()
{
$text = Neuron_Core_Text::__getInstance();
$text->setFile('chat');
$text->setSection('chat');
$login = Neuron_Core_Login::__getInstance();
$input = $this->getRequestData();
if (!isset($input['channel'])) {
$this->switchChannel($this->getDefaultChannel());
} else {
$this->channel = intval($input['channel']);
}
$input = $this->getInputData();
if ($login->isLogin()) {
if (isset($input['message'])) {
$message = trim($input['message']);
if (!empty($message)) {
$user = Neuron_GameServer::getPlayer();
if (!$user->isPlaying()) {
$this->alert($text->get('registerfirst'));
} elseif (!$user->isEmailVerified()) {
$this->alert($text->get('validateEmail_short', 'main', 'account'));
} elseif ($user->isBanned('chat')) {
$end = $user->getBanDuration('chat');
$duration = Neuron_Core_Tools::getCountdown($end);
$this->alert(Neuron_Core_Tools::putIntoText($text->get('banned'), array('duration' => $duration)));
} else {
// Post message
$this->postMessage($input['message']);
}
}
}
} else {
$this->alert($text->get('login'));
}
}
示例10: getSpeedUpBuilding
private function getSpeedUpBuilding($data)
{
$text = Neuron_Core_Text::getInstance();
$inputData = $this->getInputData();
$id = isset($data['building']) ? $data['building'] : null;
$building = Dolumar_Buildings_Building::getFromId($id);
if (!$building) {
return '<p>Invalid input: building not found: ' . $id . '</p>';
}
$price = PREMIUM_SPEEDUP_BUILDINGS_PRICE;
$unit = PREMIUM_SPEEDUP_BUILDINGS_UNIT;
if (isset($inputData['duration'])) {
$selected = abs(intval($inputData['duration']));
$desc = Neuron_Core_Tools::putIntoText($text->get('confdesc_building', 'speedup', 'statusbar'), array('building' => $building->getName(), 'amount' => Neuron_Core_Tools::getDurationText($selected * $unit)));
return $this->getConfirm($price, $unit, $selected, $desc);
}
$time = $building->getTimeLeft();
return $this->getSpeedUpHTML('building', $time, $price, $unit);
}
示例11: getContent
public function getContent($errorInput = null, $putIntoText = array())
{
// Keep original value in seperate variable!
$error = $errorInput;
$text = Neuron_Core_Text::__getInstance();
$login = Neuron_Core_Login::__getInstance();
$me = Neuron_GameServer::getPlayer();
$input = $this->getInputData();
if ($login->isLogin() && $this->village && $this->village->isActive() && $this->village->getOwner()->getId() == $me->getId()) {
// Make sure you are not in vacation mode.
if ($this->village->getOwner()->inVacationMode()) {
return '<p class="false">' . $text->get('vacationMode', 'main', 'main') . '</p>';
}
$page = new Neuron_Core_Template();
$page->set('intro', $text->get('intro', 'build', 'building'));
$page->set('construct', $text->get('construct', 'build', 'building'));
$page->set('click', $text->get('click', 'build', 'building'));
$selectrunewarning = addslashes($text->get('selectRune', 'build', 'building'));
$page->set('selectRune', $selectrunewarning);
$page->set('village', $this->village->getId());
// Workers are working.
if (!isset($error) && !$this->village->readyToBuild()) {
$error = 'stillConstructing';
}
// Show error.
if (isset($error)) {
$txterr = Neuron_Core_Tools::putIntoText($text->get($error, 'buildError', 'building'), $putIntoText);
$page->set('error', $txterr);
$page->set('errorV', $error);
if (isset($errorInput) && !empty($errorInput) && $errorInput != 'done') {
if ($error != 'done') {
switch ($error) {
case 'noRunes':
case 'noResources':
case 'stillConstructing':
$data = $this->getInputData();
$jsondata = json_encode(array('action' => 'queue', 'building' => $data['building'], 'x' => $data['x'], 'y' => $data['y'], 'rune' => $data['rune']));
$this->dialog($txterr, $text->get('queueBuild', 'queue', 'building'), 'windowAction (this, ' . $jsondata . ');', $text->get('okay', 'main', 'main'), 'void(0);');
break;
default:
$this->alert($txterr);
break;
}
}
}
}
// Get all buildings (even those who can't be build)
$buildings = Dolumar_Buildings_Building::getAllBuildings();
$buildings_out = array();
$race = $this->village->getRace();
foreach ($buildings as $buildingV) {
$building = Dolumar_Buildings_Building::getBuildingFromName($buildingV, $this->village->getRace());
if ($building->canBuildBuilding($this->village)) {
$duration = $building->getConstructionTime($this->village);
$dur = Neuron_Core_Tools::getDuration($duration);
$size = $building->getSize();
$buildings_out[] = array($building->getName(), $building->getBuildingCost_Text($this->village), $building->getDescription(), $building->getSmallImage($race), $building->getBuildingId(), $dur, $building->getImage($this->village->getRace()), $size[0], $size[1], 'canBuild' => $building->checkBuildingLevels($this->village), 'upgrade' => Neuron_Core_Tools::putIntoText($text->get('upgradeFirst', 'build', 'building'), array('name' => $building->getName(true))), 'myBuildingsName' => $building->getName($this->village->buildings->getBuildingAmount($building) > 1), 'action' => new Dolumar_View_SelectBuildLocation($building->getBuildingId(), 'build', 'building_' . $building->getBuildingId(), $building->getDisplayObject($race), null, $selectrunewarning));
}
}
// Order the list
//$page->sortList ('buildings');
usort($buildings_out, array($this, 'order_buildings'));
$page->set('list_buildings', $buildings_out);
return $page->parse('build.tpl');
} else {
return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
}
}
示例12: putIntoText
public function putIntoText($txt, $params = array())
{
return Neuron_Core_Tools::putIntoText($txt, $params);
}
示例13: getRemoveUnits
private function getRemoveUnits($objSquad)
{
$text = Neuron_Core_Text::__getInstance();
$text->setFile('squads');
$text->setSection('removeUnits');
$units = $objSquad->getUnits();
$input = $this->getInputData();
//return print_r ($units, true);
$selectedUnits = array();
$iCount = 0;
foreach ($units as $v) {
$key = 'unit_' . $v->getUnitId();
if (isset($input[$key]) && (int) $input[$key] > 0) {
$objSquad->removeUnits($v, (int) $input[$key], false);
$iCount++;
}
}
if ($iCount > 0) {
$error = $objSquad->getError();
if (!empty($error)) {
$tError = $text->get($error);
} else {
$objSquad->reloadUnits();
return $this->getSquadOverview($objSquad);
}
$units = $objSquad->getUnits();
}
$page = new Neuron_Core_Template();
$page->set('title', $text->get('title'));
$page->set('toReturn', $text->getClickTo($text->get('toReturn')));
$page->set('noUnits', $text->get('noUnits'));
$page->set('squadId', $objSquad->getId());
$page->set('about', Neuron_Core_Tools::putIntoText($text->get('about'), array(Neuron_Core_Tools::output_varchar($objSquad->getName()))));
if (isset($tError)) {
$page->set('error', $tError);
}
foreach ($units as $v) {
if ($v->getAmount() > 0 && $objSquad->getUnitType() == $v->getUnitId()) {
$page->addListValue('units', array(Neuron_Core_Tools::output_varchar($v->getName()), $v->getAmount(), $v->getUnitId()));
}
}
return $page->parse('squads/removeunits.tpl');
}
示例14: sendNewsletter
public function sendNewsletter($newsletter, $data)
{
$text = Neuron_Core_Text::getInstance();
$credits = Neuron_GameServer_Credits::getPureCreditsObject();
$plaintext = $text->getTemplate('newsletters/' . $newsletter, $data);
$subject = Neuron_Core_Tools::putIntoText($text->get($newsletter, 'subjects', 'newsletters'), $data);
// Now put it in html
$page = new Neuron_Core_Template();
$page->set('subject', $subject);
$page->set('content', Neuron_Core_Tools::output_text($plaintext));
$content = $page->parse('mailtemplate.phpt');
//echo $page->parse ('mailtemplate.phpt');
//exit;
$credits->sendNewsletter($subject, $content, $plaintext, 'en');
}
示例15: prcAttack
private function prcAttack(Dolumar_Underworld_Models_Army $target = null)
{
$text = Neuron_Core_Text::getInstance();
if (!isset($target)) {
$target = Dolumar_Underworld_Mappers_ArmyMapper::getFromId($this->getInput('target'), $this->getServer()->getMap());
if (!isset($target)) {
$this->alert('Invalid input, target not found.');
}
}
if (!$this->army->isEnemy($target)) {
$this->alert('Invalid input: not an enemy.');
}
$confirmed = $this->getInput('confirmed');
// Dialog to confirm
if (!$confirmed == '1') {
$this->dialog(Neuron_Core_Tools::putIntoText($text->get('attack', 'squad', 'underworld'), array($target->getDisplayName())), $text->get('dyes', 'main', 'main'), "windowAction (this, {'id':" . $this->army->getId() . ",'action':'attack','confirmed':1,'target':" . $target->getId() . "});", $text->get('dno', 'main', 'main'), 'void(0);');
} else {
if (!$this->army->attack($this->me, $target)) {
$this->alert($this->army->getError());
}
}
}