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


PHP Util::formatTime方法代码示例

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


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

示例1: renderTooltip

 public function renderTooltip($interactive = false, $subOf = 0, $enhance = [])
 {
     if ($this->error) {
         return;
     }
     $_name = $this->getField('name', true);
     $_reqLvl = $this->curTpl['requiredLevel'];
     $_quality = $this->curTpl['quality'];
     $_flags = $this->curTpl['flags'];
     $_class = $this->curTpl['class'];
     $_subClass = $this->curTpl['subClass'];
     $_slot = $this->curTpl['slot'];
     $causesScaling = false;
     if (!empty($enhance['r'])) {
         if ($this->getRandEnchantForItem($enhance['r'])) {
             $_name .= ' ' . Util::localizedString($this->enhanceR, 'name');
             $randEnchant = '';
             for ($i = 1; $i < 6; $i++) {
                 if ($this->enhanceR['enchantId' . $i] <= 0) {
                     continue;
                 }
                 $enchant = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?d', $this->enhanceR['enchantId' . $i]);
                 if ($this->enhanceR['allocationPct' . $i] > 0) {
                     $amount = intVal($this->enhanceR['allocationPct' . $i] * $this->generateEnchSuffixFactor());
                     $randEnchant .= '<span>' . str_replace('$i', $amount, Util::localizedString($enchant, 'name')) . '</span><br />';
                 } else {
                     $randEnchant .= '<span>' . Util::localizedString($enchant, 'name') . '</span><br />';
                 }
             }
         } else {
             unset($enhance['r']);
         }
     }
     if (isset($enhance['s']) && !in_array($_slot, [INVTYPE_WRISTS, INVTYPE_WAIST, INVTYPE_HANDS])) {
         unset($enhance['s']);
     }
     // IMPORTAT: DO NOT REMOVE THE HTML-COMMENTS! THEY ARE REQUIRED TO UPDATE THE TOOLTIP CLIENTSIDE
     $x = '';
     // upper table: stats
     if (!$subOf) {
         $x .= '<table><tr><td>';
     }
     // name; quality
     if ($subOf) {
         $x .= '<span class="q' . $_quality . '"><a href="?item=' . $this->id . '">' . $_name . '</a></span>';
     } else {
         $x .= '<b class="q' . $_quality . '">' . $_name . '</b>';
     }
     // heroic tag
     if ($_flags & ITEM_FLAG_HEROIC && $_quality == ITEM_QUALITY_EPIC) {
         $x .= '<br /><span class="q2">' . Lang::item('heroic') . '</span>';
     }
     // requires map (todo: reparse ?_zones for non-conflicting data; generate Link to zone)
     if ($_ = $this->curTpl['map']) {
         $map = DB::Aowow()->selectRow('SELECT * FROM ?_zones WHERE mapId = ?d LIMIT 1', $_);
         $x .= '<br /><a href="?zone=' . $_ . '" class="q1">' . Util::localizedString($map, 'name') . '</a>';
     }
     // requires area
     if ($this->curTpl['area']) {
         $area = DB::Aowow()->selectRow('SELECT * FROM ?_zones WHERE Id=?d LIMIT 1', $this->curTpl['area']);
         $x .= '<br />' . Util::localizedString($area, 'name');
     }
     // conjured
     if ($_flags & ITEM_FLAG_CONJURED) {
         $x .= '<br />' . Lang::item('conjured');
     }
     // bonding
     if ($_flags & ITEM_FLAG_ACCOUNTBOUND) {
         $x .= '<br /><!--bo-->' . Lang::item('bonding', 0);
     } else {
         if ($this->curTpl['bonding']) {
             $x .= '<br /><!--bo-->' . Lang::item('bonding', $this->curTpl['bonding']);
         }
     }
     // unique || unique-equipped || unique-limited
     if ($this->curTpl['maxCount'] > 0) {
         $x .= '<br />' . Lang::item('unique');
         if ($this->curTpl['maxCount'] > 1) {
             $x .= ' (' . $this->curTpl['maxCount'] . ')';
         }
     } else {
         if ($_flags & ITEM_FLAG_UNIQUEEQUIPPED) {
             $x .= '<br />' . Lang::item('uniqueEquipped');
         } else {
             if ($this->curTpl['itemLimitCategory']) {
                 $limit = DB::Aowow()->selectRow("SELECT * FROM ?_itemlimitcategory WHERE id = ?", $this->curTpl['itemLimitCategory']);
                 $x .= '<br />' . ($limit['isGem'] ? Lang::item('uniqueEquipped') : Lang::item('unique')) . Lang::main('colon') . Util::localizedString($limit, 'name') . ' (' . $limit['count'] . ')';
             }
         }
     }
     // max duration
     if ($dur = $this->curTpl['duration']) {
         $x .= "<br />" . Lang::game('duration') . Lang::main('colon') . Util::formatTime(abs($dur) * 1000) . ($this->curTpl['flagsCustom'] & 0x1 ? ' (' . Lang::item('realTime') . ')' : null);
     }
     // required holiday
     if ($eId = $this->curTpl['eventId']) {
         if ($hName = DB::Aowow()->selectRow('SELECT h.* FROM ?_holidays h JOIN ?_events e ON e.holidayId = h.id WHERE e.id = ?d', $eId)) {
             $x .= '<br />' . sprintf(Lang::game('requires'), '<a href="' . $eId . '" class="q1">' . Util::localizedString($hName, 'name') . '</a>');
         }
     }
//.........这里部分代码省略.........
开发者ID:saqar,项目名称:aowow,代码行数:101,代码来源:item.class.php

示例2: createMail

 private function createMail(&$attachmentTab, $startEnd)
 {
     $mail = [];
     if ($_ = $this->subject->getField('rewardMailTemplateId')) {
         $delay = $this->subject->getField('rewardMailDelay');
         $letter = DB::Aowow()->selectRow('SELECT * FROM ?_mailtemplate WHERE id = ?d', $_);
         $mail = array('delay' => $delay ? sprintf(Lang::quest('mailIn'), Util::formatTime($delay * 1000)) : null, 'sender' => null, 'text' => $letter ? Util::parseHtmlText(Util::localizedString($letter, 'text')) : null, 'subject' => Util::parseHtmlText(Util::localizedString($letter, 'subject')));
         foreach ($startEnd as $se) {
             if (!($se['method'] & 0x2) || $se['type'] != TYPE_NPC) {
                 continue;
             }
             if ($_ = CreatureList::getName($se['typeId'])) {
                 $mail['sender'] = sprintf(Lang::quest('mailBy'), $se['typeId'], $_);
                 break;
             }
         }
         $extraCols = ['Listview.extraCols.percent'];
         $mailLoot = new Loot();
         if ($mailLoot->getByContainer(LOOT_MAIL, $_)) {
             $this->extendGlobalData($mailLoot->jsGlobals);
             $attachmentTab = array('file' => 'item', 'data' => $mailLoot->getResult(), 'params' => array('name' => '[Mail Attachments]', 'id' => 'mail-attachments', 'extraCols' => "\$[" . implode(', ', array_merge($extraCols, $mailLoot->extraCols)) . "]", 'hiddenCols' => "\$['side', 'slot', 'reqlevel']"));
         }
     }
     return $mail;
 }
开发者ID:Niknox,项目名称:aowow,代码行数:25,代码来源:quest.php

示例3: createEffects

 private function createEffects(&$infobox, &$redButtons)
 {
     // proc data .. maybe use more information..?
     $procData = DB::World()->selectRow('SELECT IF(ppmRate > 0, -ppmRate, customChance) AS chance, cooldown FROM spell_proc_event WHERE entry = ?d', $this->typeId);
     if (!isset($procData['cooldown'])) {
         $procData['cooldown'] = 0;
     }
     $effects = [];
     $spellIdx = array_unique(array_merge($this->subject->canTriggerSpell(), $this->subject->canTeachSpell()));
     $itemIdx = $this->subject->canCreateItem();
     // Iterate through all effects:
     for ($i = 1; $i < 4; $i++) {
         if ($this->subject->getField('effect' . $i . 'Id') <= 0) {
             continue;
         }
         $effId = (int) $this->subject->getField('effect' . $i . 'Id');
         $effMV = (int) $this->subject->getField('effect' . $i . 'MiscValue');
         $effBP = (int) $this->subject->getField('effect' . $i . 'BasePoints');
         $effDS = (int) $this->subject->getField('effect' . $i . 'DieSides');
         $effRPPL = $this->subject->getField('effect' . $i . 'RealPointsPerLevel');
         $effAura = (int) $this->subject->getField('effect' . $i . 'AuraId');
         $foo =& $effects[];
         // Icons:
         // .. from item
         if (in_array($i, $itemIdx)) {
             $_ = $this->subject->getField('effect' . $i . 'CreateItemId');
             foreach ($this->subject->relItems->iterate() as $itemId => $__) {
                 if ($itemId != $_) {
                     continue;
                 }
                 $foo['icon'] = array('id' => $this->subject->relItems->id, 'name' => $this->subject->relItems->getField('name', true), 'quality' => $this->subject->relItems->getField('quality'), 'count' => $effDS + $effBP, 'icon' => $this->subject->relItems->getField('iconString'));
                 break;
             }
             if ($effDS > 1) {
                 $foo['icon']['count'] = "'" . ($effBP + 1) . '-' . $foo['icon']['count'] . "'";
             }
         } else {
             if (in_array($i, $spellIdx) || $effId == 133) {
                 $_ = $this->subject->getField('effect' . $i . 'TriggerSpell');
                 if (!$_) {
                     $_ = $this->subject->getField('effect' . $i . 'MiscValue');
                 }
                 $trig = new SpellList(array(['s.id', (int) $_]));
                 $foo['icon'] = array('id' => $_, 'name' => $trig->error ? Util::ucFirst(Lang::game('spell')) . ' #' . $_ : $trig->getField('name', true), 'count' => 0);
                 $this->extendGlobalData($trig->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
             }
         }
         // Effect Name
         $foo['name'] = (User::isInGroup(U_GROUP_EMPLOYEE) ? sprintf(Util::$dfnString, 'EffectId: ' . $effId, Util::$spellEffectStrings[$effId]) : Util::$spellEffectStrings[$effId]) . Lang::main('colon');
         if ($this->subject->getField('effect' . $i . 'RadiusMax') > 0) {
             $foo['radius'] = $this->subject->getField('effect' . $i . 'RadiusMax');
         }
         if (!in_array($i, $itemIdx) && !in_array($i, $spellIdx) && !in_array($effAura, [225, 227])) {
             $foo['value'] = ($effDS && $effDS != 1 ? $effBP + 1 . Lang::game('valueDelim') : null) . ($effBP + $effDS);
         }
         if ($effRPPL != 0) {
             $foo['value'] = (isset($foo['value']) ? $foo['value'] : '0') . sprintf(Lang::spell('costPerLevel'), $effRPPL);
         }
         if ($this->subject->getField('effect' . $i . 'Periode') > 0) {
             $foo['interval'] = Util::formatTime($this->subject->getField('effect' . $i . 'Periode'));
         }
         if ($_ = $this->subject->getField('effect' . $i . 'Mechanic')) {
             $foo['mechanic'] = Lang::game('me', $_);
         }
         if (!empty($procData['chance'])) {
             $foo['procData'] = array($procData['chance'], $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null);
         } else {
             if (in_array($i, $this->subject->canTriggerSpell()) && $this->subject->getField('procChance')) {
                 $foo['procData'] = array($this->subject->getField('procChance'), $procData['cooldown'] ? Util::formatTime($procData['cooldown'] * 1000, true) : null);
             }
         }
         // parse masks and indizes
         switch ($effId) {
             case 8:
                 // Power Drain
             // Power Drain
             case 30:
                 // Energize
             // Energize
             case 137:
                 // Energize Pct
                 $_ = Lang::spell('powerTypes', $effMV);
                 if ($_ && User::isInGroup(U_GROUP_EMPLOYEE)) {
                     $_ = sprintf(Util::$dfnString, Lang::spell('_value') . Lang::main('colon') . $effMV, $_);
                 } else {
                     if (!$_) {
                         $_ = $effMV;
                     }
                 }
                 if ($effMV == POWER_RAGE || $effMV == POWER_RUNIC_POWER) {
                     $foo['value'] = ($effDS && $effDS != 1 ? ($effBP + 1) / 10 . Lang::game('valueDelim') : null) . ($effBP + $effDS) / 10;
                 }
                 $foo['name'] .= ' (' . $_ . ')';
                 break;
             case 16:
                 // QuestComplete
                 if ($_ = QuestList::getName($effMV)) {
                     $foo['name'] .= '(<a href="?quest=' . $effMV . '">' . $_ . '</a>)';
                 } else {
                     $foo['name'] .= Util::ucFirst(Lang::game('quest')) . ' #' . $effMV;
//.........这里部分代码省略.........
开发者ID:Niknox,项目名称:aowow,代码行数:101,代码来源:spell.php

示例4: renderBuff

 public function renderBuff($level = MAX_LEVEL, $interactive = false)
 {
     if (!$this->curTpl) {
         return ['', []];
     }
     // doesn't have a buff
     if (!$this->getField('buff', true)) {
         return ['', []];
     }
     $this->interactive = $interactive;
     $x = '<table><tr>';
     // spellName
     $x .= '<td><b class="q">' . $this->getField('name', true) . '</b></td>';
     // dispelType (if applicable)
     if ($this->curTpl['dispelType']) {
         if ($dispel = Lang::game('dt', $this->curTpl['dispelType'])) {
             $x .= '<th><b class="q">' . $dispel . '</b></th>';
         }
     }
     $x .= '</tr></table>';
     $x .= '<table><tr><td>';
     // parse Buff-Text
     $btt = $this->parseText('buff', $level, $this->interactive, $scaling);
     $x .= $btt[0] . '<br>';
     // duration
     if ($this->curTpl['duration'] > 0) {
         $x .= '<span class="q">' . sprintf(Lang::spell('remaining'), Util::formatTime($this->curTpl['duration'])) . '<span>';
     }
     $x .= '</td></tr></table>';
     // scaling information - spellId:min:max:curr
     $x .= '<!--?' . $this->id . ':1:' . ($scaling ? MAX_LEVEL : 1) . ':' . $level . '-->';
     return [$x, $btt[1]];
 }
开发者ID:saqar,项目名称:aowow,代码行数:33,代码来源:spell.class.php

示例5: generateContent

 protected function generateContent()
 {
     $this->addJS('?data=zones&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
     /***********/
     /* Infobox */
     /***********/
     $infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
     // Event (ignore events, where the object only gets removed)
     if ($_ = DB::World()->selectCol('SELECT DISTINCT IF(ge.holiday, ge.holiday, -ge.eventEntry) FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.eventEntry = geg.eventEntry AND g.guid = geg.guid AND g.id = ?d', $this->typeId)) {
         $this->extendGlobalIds(TYPE_WORLDEVENT, $_);
         $ev = [];
         foreach ($_ as $i => $e) {
             $ev[] = ($i % 2 ? '[br]' : ' ') . '[event=' . $e . ']';
         }
         $infobox[] = Util::ucFirst(Lang::game('eventShort')) . Lang::main('colon') . implode(',', $ev);
     }
     // Reaction
     $_ = function ($r) {
         if ($r == 1) {
             return 2;
         }
         if ($r == -1) {
             return 10;
         }
         return;
     };
     $infobox[] = Lang::npc('react') . Lang::main('colon') . '[color=q' . $_($this->subject->getField('A')) . ']A[/color] [color=q' . $_($this->subject->getField('H')) . ']H[/color]';
     // reqSkill
     switch ($this->subject->getField('typeCat')) {
         case -3:
             // Herbalism
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 2) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         case -4:
             // Mining
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 3) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         case -5:
             // Lockpicking
             $infobox[] = sprintf(Lang::game('requires'), Lang::spell('lockType', 1) . ' (' . $this->subject->getField('reqSkill') . ')');
             break;
         default:
             $locks = Lang::getLocks($this->subject->getField('lockId'));
             $l = '';
             foreach ($locks as $idx => $_) {
                 if ($idx < 0) {
                     continue;
                 }
                 $this->extendGlobalIds(TYPE_ITEM, $idx);
                 $l = Lang::gameObject('key') . Lang::main('colon') . '[item=' . $idx . ']';
             }
             // if no propper item is found use a skill
             if ($locks) {
                 $infobox[] = $l ? $l : array_pop($locks);
             }
     }
     // linked trap
     if ($_ = $this->subject->getField('linkedTrap')) {
         $this->extendGlobalIds(TYPE_OBJECT, $_);
         $infobox[] = Lang::gameObject('trap') . Lang::main('colon') . '[object=' . $_ . ']';
     }
     // trap for
     $trigger = new GameObjectList(array(['linkedTrap', $this->typeId]));
     if (!$trigger->error) {
         $this->extendGlobalData($trigger->getJSGlobals());
         $infobox[] = Lang::gameObject('triggeredBy') . Lang::main('colon') . '[object=' . $trigger->id . ']';
     }
     // SpellFocus
     if ($_ = $this->subject->getField('spellFocusId')) {
         if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE id = ?d', $_)) {
             $infobox[] = '[tooltip name=focus]' . Lang::gameObject('focusDesc') . '[/tooltip][span class=tip tooltip=focus]' . Lang::gameObject('focus') . Lang::main('colon') . Util::localizedString($sfo, 'name') . '[/span]';
         }
     }
     // lootinfo: [min, max, restock]
     if (($_ = $this->subject->getField('lootStack')) && $_[0]) {
         $buff = Lang::item('charges') . Lang::main('colon') . $_[0];
         if ($_[0] < $_[1]) {
             $buff .= Lang::game('valueDelim') . $_[1];
         }
         // since Veins don't have charges anymore, the timer is questionable
         $infobox[] = $_[2] > 1 ? '[tooltip name=restock]' . sprintf(Lang::gameObject('restock'), Util::formatTime($_[2] * 1000)) . '[/tooltip][span class=tip tooltip=restock]' . $buff . '[/span]' : $buff;
     }
     // meeting stone [minLevel, maxLevel, zone]
     if ($this->subject->getField('type') == OBJECT_MEETINGSTONE) {
         if ($_ = $this->subject->getField('mStone')) {
             $this->extendGlobalIds(TYPE_ZONE, $_[2]);
             $m = Lang::game('meetingStone') . Lang::main('colon') . '[zone=' . $_[2] . ']';
             $l = $_[0];
             if ($_[0] > 1 && $_[1] > $_[0]) {
                 $l .= Lang::game('valueDelim') . min($_[1], MAX_LEVEL);
             }
             $infobox[] = $l ? '[tooltip name=meetingstone]' . sprintf(Lang::game('reqLevel'), $l) . '[/tooltip][span class=tip tooltip=meetingstone]' . $m . '[/span]' : $m;
         }
     }
     // capture area [minPlayer, maxPlayer, minTime, maxTime, radius]
     if ($this->subject->getField('type') == OBJECT_CAPTURE_POINT) {
         if ($_ = $this->subject->getField('capture')) {
             $buff = Lang::gameObject('capturePoint');
             if ($_[2] > 1 || $_[0]) {
                 $buff .= Lang::main('colon') . '[ul]';
//.........这里部分代码省略.........
开发者ID:Carbenium,项目名称:aowow,代码行数:101,代码来源:object.php

示例6: registerInternalCommands


//.........这里部分代码省略.........
         echo '10* Current usage: ', sprintf('%.2f MB', memory_get_usage() / 1024 / 1024), ' | 10Top usage: ', sprintf('%.2f MB', memory_get_peak_usage() / 1024 / 1024), ' | 10Garbage: ', sprintf('%.2f kB', $aGarbage['Memory']);
     }, SecurityManager::PERMISSION_BOT_OWNER))->registerCommand(new Command('restart', function ($pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         Nuwani\BotManager::getInstance()->getBotList()->send('QUIT :Restart requested by ' . $sNickname);
         usleep(150000);
         die(exec('php ' . $_SERVER['argv'][0] . ' restart'));
     }, SecurityManager::PERMISSION_BOT_OWNER))->registerCommand(new Command('cmdpermission', function ($pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         if (count($aParams) != 2) {
             echo '!cmdpermission command level';
             return Command::OUTPUT_USAGE;
         } else {
             if (!Nuwani\ModuleManager::getInstance()->offsetGet('Commands')->setCommandPermission($aParams[0], $aParams[1])) {
                 echo 'The command has not been found.';
                 return Command::OUTPUT_ERROR;
             } else {
                 echo 'The required permission has been updated successfully.';
                 return Command::OUTPUT_SUCCESS;
             }
         }
     }, SecurityManager::PERMISSION_BOT_OWNER))->registerCommand(new Command('useradd', function (Bot $pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         if (count($aParams) != 1) {
             echo '!useradd usermask';
             return Command::OUTPUT_USAGE;
         } else {
             if ($pBot->getSecurityManager()->isUserKnown($aParams[0])) {
                 echo 'Given user mask is already known.';
                 return Command::OUTPUT_ERROR;
             }
             $pBot->getSecurityManager()->addUser($aParams[0]);
             echo 'User ' . $aParams[0] . ' has been added.';
             return Command::OUTPUT_SUCCESS;
         }
     }, SecurityManager::PERMISSION_BOT_OWNER))->registerCommand(new Command('permissiongrant', function (Bot $pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         if (count($aParams) != 2) {
             echo '!permissiongrant usermask permission';
             return Command::OUTPUT_USAGE;
         } else {
             if (!$pBot->getSecurityManager()->isUserKnown($aParams[0])) {
                 echo 'Given user mask does not match any known users.';
                 return Command::OUTPUT_ERROR;
             }
             $user = new Nuwani\User($pBot['Network'], $aParams[0]);
             if ($pBot->getSecurityManager()->grantPermission($user, $aParams[1])) {
                 echo 'User ' . (string) $user . ' has been granted the "' . $aParams[1] . '" permission.';
                 return Command::OUTPUT_SUCCESS;
             } else {
                 echo 'User ' . (string) $user . ' already has the "' . $aParams[1] . '" permission.';
                 return Command::OUTPUT_NOTICE;
             }
         }
     }, SecurityManager::PERMISSION_BOT_OWNER))->registerCommand(new Command('permissionrevoke', function (Bot $pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         if (count($aParams) != 2) {
             echo '!permissionrevoke usermask permission';
             return Command::OUTPUT_USAGE;
         } else {
             if (!$pBot->getSecurityManager()->isUserKnown($aParams[0])) {
                 echo 'Given user mask does not match any known users.';
                 return Command::OUTPUT_ERROR;
             }
             $user = new Nuwani\User($pBot['Network'], $aParams[0]);
             if ($pBot->getSecurityManager()->revokePermission($user, $aParams[1])) {
                 echo 'The "' . $aParams[1] . '" permission has been revoked from user ' . (string) $user . '.';
                 return Command::OUTPUT_SUCCESS;
             } else {
                 echo 'User ' . (string) $user . ' doesn\'t have the "' . $aParams[1] . '" permission.';
                 return Command::OUTPUT_NOTICE;
             }
         }
     }, SecurityManager::PERMISSION_BOT_OWNER))->registerCommand(new Command('permissionshow', function (Bot $pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         if (count($aParams) != 1) {
             echo '!permissionshow usermask';
             return Command::OUTPUT_USAGE;
         } else {
             $user = null;
             if ($aParams[0] == 'me' || $aParams[0] == 'self') {
                 $user = $pBot->In->User;
             } else {
                 $user = new Nuwani\User($pBot['Network'], $aParams[0]);
             }
             $permissions = $pBot->getSecurityManager()->getPermissionList($user);
             if (empty($permissions)) {
                 echo 'User ' . (string) $user . ' doesn\'t have any permissions.';
                 return Command::OUTPUT_INFO;
             } else {
                 echo 'User ' . (string) $user . ' has the following permissions: ' . implode(', ', $permissions);
                 return Command::OUTPUT_INFO;
             }
         }
     }, null))->registerCommand(new Command('runningtimers', function ($pBot, $sDestination, $sChannel, $sNickname, $sParams, $sMessage) {
         echo '10* Running timers: ';
         $message = '';
         foreach (Nuwani\Timer::getActiveTimers() as $timerInfo) {
             $message .= $timerInfo['name'];
             $message .= ' 14(ID: ' . $timerInfo['id'];
             $message .= ', in ' . Util::formatTime($timerInfo['next_run'] - microtime(true), true);
             $message .= $timerInfo['type'] == Nuwani\Timer::TIMEOUT ? ', once' : '';
             $message .= '), ';
         }
         echo wordwrap(substr($message, 0, -2), 400);
     }, SecurityManager::PERMISSION_BOT_OWNER));
 }
开发者ID:xhoogland,项目名称:Monique,代码行数:101,代码来源:Module.php

示例7: date

        <div class="footer">
<?php 
if (User::isInGroup(U_GROUP_EMPLOYEE) && ($this->time || isset($this->mysql) || $this->isCached)) {
    echo "            <table style=\"margin:auto;\">\n";
    if (isset($this->mysql)) {
        echo '                <tr><td style="text-align:left;">' . Lang::main('numSQL') . '</td><td>' . $this->mysql['count'] . "</td></tr>\n";
        echo '                <tr><td style="text-align:left;">' . Lang::main('timeSQL') . '</td><td>' . Util::formatTime($this->mysql['time'] * 1000, true) . "</td></tr>\n";
    }
    if ($this->time) {
        echo '                <tr><td style="text-align:left;">Page generated in</td><td>' . Util::formatTime($this->time * 1000, true) . "</td></tr>\n";
    }
    if ($this->cacheLoaded && $this->cacheLoaded[0] == CACHE_MODE_FILECACHE) {
        echo "                <tr><td style=\"text-align:left;\">reloaded from filecache</td><td>created" . Lang::main('colon') . date(Lang::main('dateFmtLong'), $this->cacheLoaded[1]) . "</td></tr>\n";
    } elseif ($this->cacheLoaded && $this->cacheLoaded[0] == CACHE_MODE_MEMCACHED) {
        echo "                <tr><td style=\"text-align:left;\">reloaded from memcached</td><td>created" . Lang::main('colon') . date(Lang::main('dateFmtLong'), $this->cacheLoaded[1]) . "</td></tr>\n";
    }
    echo "            </table>\n";
}
?>
        </div>
    </div><!-- #wrapper .nosidebar -->
    </div><!-- #layout-inner -->
</div><!-- #layout .nosidebar -->

<noscript>
    <div id="noscript-bg"></div>
    <div id="noscript-text"><?php 
echo Lang::main('noJScript');
?>
</div>
</noscript>
开发者ID:saqar,项目名称:aowow,代码行数:31,代码来源:footer.tpl.php

示例8: postCache

 protected function postCache()
 {
     // update dates to now()
     $updated = WorldEventList::updateDates($this->dates);
     if ($this->mode == CACHE_TYPE_TOOLTIP) {
         return array(date(Lang::main('dateFmtLong'), $updated['start']), date(Lang::main('dateFmtLong'), $updated['end']));
     } else {
         if ($this->hId) {
             Util::$wowheadLink = 'http://' . Util::$subDomains[User::$localeId] . '.wowhead.com/event=' . $this->hId;
         }
         /********************/
         /* finalize infobox */
         /********************/
         // start
         if ($updated['start']) {
             array_push($this->infobox, Lang::event('start') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['start']));
         }
         // end
         if ($updated['end']) {
             array_push($this->infobox, Lang::event('end') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['end']));
         }
         // occurence
         if ($updated['rec'] > 0) {
             array_push($this->infobox, Lang::event('interval') . Lang::main('colon') . Util::formatTime($updated['rec'] * 1000));
         }
         // in progress
         if ($updated['start'] < time() && $updated['end'] > time()) {
             array_push($this->infobox, '[span class=q2]' . Lang::event('inProgress') . '[/span]');
         }
         $this->infobox = '[ul][li]' . implode('[/li][li]', $this->infobox) . '[/li][/ul]';
         /***************************/
         /* finalize related events */
         /***************************/
         foreach ($this->lvTabs as &$view) {
             if ($view[0] != WorldEventList::$brickFile) {
                 continue;
             }
             foreach ($view[1]['data'] as &$data) {
                 $updated = WorldEventList::updateDates($data['_date']);
                 unset($data['_date']);
                 $data['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false;
                 $data['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false;
                 $data['rec'] = $updated['rec'];
             }
         }
     }
 }
开发者ID:TrinityCore,项目名称:aowow,代码行数:47,代码来源:event.php

示例9: createFullSpawns

 private function createFullSpawns()
 {
     $data = [];
     $wpSum = [];
     $wpIdx = 0;
     $spawns = DB::Aowow()->select("SELECT * FROM ?_spawns WHERE type = ?d AND typeId = ?d", self::$type, $this->id);
     if (!$spawns) {
         return;
     }
     foreach ($spawns as $s) {
         // check, if we can attach waypoints to creature
         // we will get a nice clusterfuck of dots if we do this for more GUIDs, than we have colors though
         if (count($spawns) < 6 && self::$type == TYPE_NPC) {
             if ($wPoints = DB::Aowow()->select('SELECT * FROM ?_creature_waypoints WHERE creatureOrPath = ?d AND floor = ?d', $s['pathId'] ? -$s['pathId'] : $this->id, $s['floor'])) {
                 foreach ($wPoints as $i => $p) {
                     $label = [Lang::npc('waypoint') . Lang::main('colon') . $p['point']];
                     if ($p['wait']) {
                         $label[] = Lang::npc('wait') . Lang::main('colon') . Util::formatTime($p['wait'], false);
                     }
                     $set = ['label' => '$<br><span class="q0">' . implode('<br>', $label) . '</span>', 'type' => $wpIdx];
                     // connective line
                     if ($i > 0) {
                         $set['lines'] = [[$wPoints[$i - 1]['posX'], $wPoints[$i - 1]['posY']]];
                     }
                     $data[$s['areaId']][$s['floor']]['coords'][] = [$p['posX'], $p['posY'], $set];
                     if (empty($wpSum[$s['areaId']][$s['floor']])) {
                         $wpSum[$s['areaId']][$s['floor']] = 1;
                     } else {
                         $wpSum[$s['areaId']][$s['floor']]++;
                     }
                 }
                 $wpIdx++;
             }
         }
         $label = [];
         if (User::isInGroup(U_GROUP_STAFF)) {
             $label[] = $s['guid'] < 0 ? 'Vehicle Accessory' : 'GUID' . Lang::main('colon') . $s['guid'];
         }
         if ($s['respawn']) {
             $label[] = Lang::npc('respawnIn') . Lang::main('colon') . Util::formatTime($s['respawn'] * 1000, false);
         }
         if (User::isInGroup(U_GROUP_STAFF)) {
             if ($s['phaseMask'] > 1 && ($s['phaseMask'] & 0xffff) != 0xffff) {
                 $label[] = Lang::game('phases') . Lang::main('colon') . Util::asHex($s['phaseMask']);
             }
             if ($s['spawnMask'] == 15) {
                 $label[] = Lang::game('mode') . Lang::main('colon') . Lang::game('modes', -1);
             } else {
                 if ($s['spawnMask']) {
                     $_ = [];
                     for ($i = 0; $i < 4; $i++) {
                         if ($s['spawnMask'] & 1 << $i) {
                             $_[] = Lang::game('modes', $i);
                         }
                     }
                     $label[] = Lang::game('mode') . Lang::main('colon') . implode(', ', $_);
                 }
             }
         }
         $data[$s['areaId']][$s['floor']]['coords'][] = [$s['posX'], $s['posY'], ['label' => '$<br><span class="q0">' . implode('<br>', $label) . '</span>']];
     }
     foreach ($data as $a => &$areas) {
         foreach ($areas as $f => &$floor) {
             $floor['count'] = count($floor['coords']) - (!empty($wpSum[$a][$f]) ? $wpSum[$a][$f] : 0);
         }
     }
     $this->spawnResult[SPAWNINFO_FULL] = $data;
 }
开发者ID:Niknox,项目名称:aowow,代码行数:68,代码来源:basetype.class.php

示例10: array

                            <!--                        <div class="kanban-item-title">
                            <?php 
            //                            echo CHtml::link($credito->fecha_credito, "");
            //                            echo CHtml::link($cliente->nombre_formato, "", array("id" => $cliente->id, "onClick" => "viewModal('incidencias/incidencia/view/id/" . $cliente->id . "')"));
            ?>
                                                    </div>-->
                            <div><label>Emisor: </label> <?php 
            echo Empleado::model()->find('userid=:idUser', array(':idUser' => $tarea->usuario_creacion_id))->nombre_completo;
            ?>
</div>
                            <!--<div><label>Responsable: </label> <?php 
            // echo Empleado::model()->find('id=:idUser', array(':idUser' => $tarea->responsable_id))->nombre_completo;
            ?>
</div>-->
                            <div><label>fecha y hora fin: </label> <?php 
            echo Util::FormatDate($tarea->fecha_fin, 'd/m/Y') . " a las " . Util::formatTime($tarea->hora_fin);
            ?>
</div>
                            <div><label>descripcion: </label> <?php 
            echo Util::Truncate($tarea->descripcion, 20);
            ?>
</div>
                            <div >
                                <?php 
            //                            $this->widget(
            //                                    'ext.bootstrap.widgets.TbToggleButton', array(
            //                                'name' => 'testToggleButtonB',
            //                                'enabledLabel' => 'Aprobado',
            //                                'disabledLabel' => 'En espera...',
            //                                'value' => $cliente->aprobado,
            //                                'onChange' => 'js:function($el, status, e){ actualizarAprobado($cliente_id,status);}',
开发者ID:Wladimir89,项目名称:software1grh,代码行数:31,代码来源:_kanban.php

示例11: sendMail

 private function sendMail($subj, $msg, $delay = 300)
 {
     // send recovery mail
     $subj = CFG_NAME_SHORT . Lang::main('colon') . $subj;
     $msg .= "\r\n\r\n" . sprintf(Lang::mail('tokenExpires'), Util::formatTime($delay * 1000)) . "\r\n";
     $header = 'From: ' . CFG_CONTACT_EMAIL . "\r\n" . 'Reply-To: ' . CFG_CONTACT_EMAIL . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     if (!mail($this->_post['email'], $subj, $msg, $header)) {
         return sprintf(Lang::main('intError2'), 'send mail');
     }
 }
开发者ID:TrinityCore,项目名称:aowow,代码行数:10,代码来源:account.php

示例12: postCache

 protected function postCache()
 {
     /********************/
     /* finalize infobox */
     /********************/
     // update dates to now()
     $updated = WorldEventList::updateDates($this->dates);
     // start
     if ($updated['start']) {
         array_push($this->infobox, Lang::event('start') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['start']));
     }
     // end
     if ($updated['end']) {
         array_push($this->infobox, Lang::event('end') . Lang::main('colon') . date(Lang::main('dateFmtLong'), $updated['end']));
     }
     // occurence
     if ($updated['rec'] > 0) {
         array_push($this->infobox, Lang::event('interval') . Lang::main('colon') . Util::formatTime($updated['rec'] * 1000));
     }
     // in progress
     if ($updated['start'] < time() && $updated['end'] > time()) {
         array_push($this->infobox, '[span class=q2]' . Lang::event('inProgress') . '[/span]');
     }
     $this->infobox = '[ul][li]' . implode('[/li][li]', $this->infobox) . '[/li][/ul]';
     /***************************/
     /* finalize related events */
     /***************************/
     foreach ($this->lvTabs as &$view) {
         if ($view['file'] != WorldEventList::$brickFile) {
             continue;
         }
         foreach ($view['data'] as &$data) {
             $updated = WorldEventList::updateDates($data['_date']);
             unset($data['_date']);
             $data['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false;
             $data['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false;
             $data['rec'] = $updated['rec'];
         }
     }
 }
开发者ID:Carbenium,项目名称:aowow,代码行数:40,代码来源:event.php

示例13: addSeenCommand

 /**
  * This function adds the .seen-command internally since the code is too long.
  */
 private function addSeenCommand()
 {
     Nuwani\ModuleManager::getInstance()->offsetGet('Commands')->registerCommand(new Command('.seen', function ($pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         $oLastSeenPerson = new Nuwani\Model('lvp_person_last_seen', 'lvp_person_last_seen_id', $aParams[0]);
         if ($aParams[0] == '') {
             echo '!msg * Usage: .seen <username>';
         } else {
             if (!is_null($oLastSeenPerson->lvp_person_last_seen_id)) {
                 if ($oLastSeenPerson->sReason == 'online') {
                     echo '!msg ' . $oLastSeenPerson->lvp_person_last_seen_id . ' is already online for ' . Util::formatTime(time() - $oLastSeenPerson->iTime, true) . '.';
                 } else {
                     echo '!msg ' . $oLastSeenPerson->lvp_person_last_seen_id . ' was last seen online ' . date('H:i:s @ d-m-Y', $oLastSeenPerson->iTime) . ' ' . $oLastSeenPerson->sReason;
                 }
             } else {
                 echo '!msg * Error: Sorry, this username has not (yet) been found.';
             }
         }
     }));
 }
开发者ID:xhoogland,项目名称:Monique,代码行数:22,代码来源:LVPrewrite.php

示例14: generateRSS

 protected function generateRSS()
 {
     $this->generateContent();
     $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<rss version=\"2.0\">\n<channel>\n" . "<title>" . CFG_NAME_SHORT . ' - ' . $this->name . "</title>\n" . "<link>" . HOST_URL . '?' . $this->page . ($this->category ? '=' . $this->category[0] : null) . "</link>\n" . "<description>" . CFG_NAME . "</description>\n" . "<language>" . implode('-', str_split(User::$localeString, 2)) . "</language>\n" . "<ttl>" . CFG_TTL_RSS . "</ttl>\n" . "<lastBuildDate>" . date(DATE_RSS) . "</lastBuildDate>\n";
     foreach ($this->lvTabs[0]['data'] as $row) {
         $xml .= "<item>\n" . "<title><![CDATA[" . htmlentities($row['subject']) . "]]></title>\n" . "<link>" . HOST_URL . '?go-to-comment&amp;id=' . $row['id'] . "</link>\n" . "<description><![CDATA[" . htmlentities($row['preview']) . " " . sprintf(Lang::timeUnits('ago'), Util::formatTime($row['elapsed'] * 100, true)) . "]]></description>\n" . "<pubDate>" . date(DATE_RSS, time() - $row['elapsed']) . "</pubDate>\n" . "<guid>" . HOST_URL . '?go-to-comment&amp;id=' . $row['id'] . "</guid>\n" . "<domain />\n" . "</item>\n";
     }
     $xml .= "</channel>\n</rss>";
     return $xml;
 }
开发者ID:Carbenium,项目名称:aowow,代码行数:10,代码来源:utility.php

示例15: CLTimeParser

 public static function CLTimeParser($time, $l = "load")
 {
     if ($l == "load") {
         return Util::formatTime($_SESSION["S"]->getUserLanguage(), $time);
     }
     if ($l == "store") {
         return Util::parseTime($_SESSION["S"]->getUserLanguage(), $time);
     }
 }
开发者ID:nemiah,项目名称:fheME,代码行数:9,代码来源:Util.class.php


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