本文整理汇总了PHP中Util类的典型用法代码示例。如果您正苦于以下问题:PHP Util类的具体用法?PHP Util怎么用?PHP Util使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Util类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createApp
function createApp($appName, $orgName)
{
Util::throwExceptionIfNullOrBlank($appName, "App Name");
Util::throwExceptionIfNullOrBlank($orgName, "orgName");
$objUtil = new Util($this->apiKey, $this->secretKey);
try {
$params = array();
$params['apiKey'] = $this->apiKey;
$params['version'] = $this->version;
date_default_timezone_set('UTC');
$params['timeStamp'] = date("Y-m-d\\TG:i:s") . substr((string) microtime(), 1, 4) . "Z";
$params['App Name'] = $appName;
$params['orgName'] = $orgName;
$signature = urlencode($objUtil->sign($params));
//die();
$body = null;
$body = '{"app42":{"app":}}';
$params['body'] = $body;
$params['signature'] = $signature;
$contentType = $this->content_type;
$accept = $this->accept;
$this->url = $this->url;
$response = RestClient::post($this->url, $params, null, null, $contentType, $accept, $body);
} catch (App42Exception $e) {
throw $e;
} catch (Exception $e) {
throw new App42Exception($e);
}
return $response;
}
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:30,代码来源:App.php
示例2: emailExists
/**
* A method to check if an email exists
*
* @param {String} [$email] - must be valid email
*
* @return boolean
*/
public function emailExists($email)
{
$u = new Util();
$db = new DB($u->getDBConfig());
$stmt = $db->getDb()->prepare("SELECT * FROM users WHERE email = :email");
$stmt->bindParam(':email', $email, PDO::PARAM_STR);
$stmt->execute();
if ($stmt->rowCount() > 0) {
return false;
}
return true;
}
开发者ID:bowen9284,项目名称:PHPAdvClassFall2015,代码行数:19,代码来源:Validator.php
示例3: commitFile
/**
* 向网站提交数据
*/
public function commitFile()
{
$starttime = date('Y-m-d H:i:s');
$util = new \Util();
$res = $util->commitData();
// var_dump($res);
$endtime = date('Y-m-d H:i:s');
$this->assign('starttime', $starttime);
$this->assign('endtime', $endtime);
$this->assign('list', $res);
$this->assign('count', count($res));
$this->display();
}
开发者ID:nanfeng,项目名称:dginfo,代码行数:16,代码来源:IndexController.class.php
示例4: cadastrarAction
public function cadastrarAction()
{
$ct = new Categoria();
$ut = new Util();
$user = My_Auth::getInstance('Painel')->getStorage()->read();
$request = $this->getRequest();
if ($request->isPost()) {
$pt = new Postagem();
$erro = false;
$msg = '';
$now = $ut->nowDateSql();
$pt->setTitulo($request->getPost('titulo'));
$pt->setPostagem($request->getPost('postagem'));
$pt->setCagegoriaId($request->getPost('categoria_id'));
$pt->setUsuarioId($user->id);
$pt->setPostadoem($now);
$pt->setTags($request->getPost('tags'));
$pt->setAlteradoem($now);
$data = array('titulo' => $pt->getTitulo(), 'postagem' => $pt->getPostagem(), 'categoria_id' => $pt->getCagegoriaId(), 'usuario_id' => $pt->getUsuarioId(), 'postadoem' => $pt->getPostadoem(), 'tags' => $pt->getTags(), 'alteradoem' => $pt->getAlteradoem());
if ($postagem_id = $pt->savePostagem($data)) {
if ($request->getPost('image_data')) {
$imageName = time() . '_saved.jpg';
//$imagem = json_decode($request->getPost('image_data'));
$base64 = base64_decode(preg_replace('#^data:image/[^;]+;base64,#', '', $request->getPost('image_data')));
//base64_decode(preg_replace('#^data:image/[^;]+;base64,#', '', $_POST['imagem']));
// create image
$source = imagecreatefromstring($base64);
if (!file_exists(ROOT_DIR . DS . 'site' . DS . 'images' . DS . 'blog' . DS . $postagem_id)) {
mkdir(ROOT_DIR . DS . 'site' . DS . 'images' . DS . 'blog' . DS . $postagem_id, 0777, true);
}
$url = ROOT_DIR . DS . 'site' . DS . 'images' . DS . 'blog' . DS . $postagem_id . DS . $imageName;
imagejpeg($source, $url, 100);
$pt->setImagem($imageName);
$data = array('imagem' => $pt->getImagem());
if (!$pt->savePostagem($data, $postagem_id)) {
$erro = true;
}
}
} else {
$erro = true;
}
if ($erro) {
$msg = 'Ocorreu um erro, tente novamente';
$this->view->msg = $msg;
} else {
$this->_helper->redirector('listar', 'postagens');
}
}
$this->view->categorias = $ct->getAllCategoria();
$this->render();
}
开发者ID:agenciaaeh,项目名称:kahina,代码行数:51,代码来源:PostagensController.php
示例5: HistorySpec
function HistorySpec($query)
{
$util = new Util();
$myDateToday = $util->dateTodaySQL();
$queryMYSQL = new QueryMYSQL();
//cherche le dernier groupe
$queryMaxGroup = "select max(GROUPE) `maxGROUPE` from HISTORIQUE";
echo $queryMaxGroup . "<br/>";
$arrayMax = $queryMYSQL->select_n($queryMaxGroup);
$groupe = $arrayMax[0]["maxGROUPE"];
$groupe = $groupe + 1;
$queryHistory = "insert into HISTORIQUE (GROUPE,VARIABLE,login,date_modif) values ({$groupe},\"{$query}\",'" . $_SESSION['login'] . "','{$myDateToday}')";
//echo $queryHistory."<br/>";
$queryMYSQL->query($queryHistory);
}
开发者ID:Polou,项目名称:GoldAdventure,代码行数:15,代码来源:History.class.php
示例6: buildHttpQuery
/**
* @param $params
*
* @return string
*/
public static function buildHttpQuery($params)
{
if (!$params) {
return '';
}
// Urlencode both keys and values
$keys = Util::urlencodeRfc3986(array_keys($params));
$values = Util::urlencodeRfc3986(array_values($params));
$params = array_combine($keys, $values);
// Parameters are sorted by name, using lexicographical byte value ordering.
// Ref: Spec: 9.1.1 (1)
uksort($params, 'strcmp');
$pairs = array();
foreach ($params as $parameter => $value) {
if (is_array($value)) {
// If two or more parameters share the same name, they are sorted by their value
// Ref: Spec: 9.1.1 (1)
// June 12th, 2010 - changed to sort because of issue 164 by hidetaka
sort($value, SORT_STRING);
foreach ($value as $duplicateValue) {
$pairs[] = $parameter . '=' . $duplicateValue;
}
} else {
$pairs[] = $parameter . '=' . $value;
}
}
// For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
// Each name-value pair is separated by an '&' character (ASCII code 38)
return implode('&', $pairs);
}
开发者ID:TechLoCo,项目名称:twitteroauth,代码行数:35,代码来源:Util.php
示例7: get_unresolved_alarms
function get_unresolved_alarms($conn)
{
$alarms = intval(Alarm::get_count($conn, '', '', 1, TRUE));
$alarms_prev = intval($_SESSION['_unresolved_alarms']);
if ($alarms != $alarms_prev && $alarms_prev > 0) {
$new_alarms = $alarms - $alarms_prev;
} else {
$new_alarms = 0;
}
$_SESSION['_unresolved_alarms'] = $alarms;
$data['alarms'] = $alarms;
$data['new_alarms'] = $new_alarms;
$data['new_alarms_desc'] = '';
if ($new_alarms > 0) {
$criteria = array('src_ip' => '', 'dst_ip' => '', 'hide_closed' => 1, 'order' => 'ORDER BY a.timestamp DESC', 'inf' => 0, 'sup' => $new_alarms, 'date_from' => '', 'date_to' => '', 'query' => '', 'directive_id' => '', 'intent' => 0, 'sensor' => '', 'tag' => '', 'num_events' => '', 'num_events_op' => 0, 'plugin_id' => '', 'plugin_sid' => '', 'ctx' => '', 'host' => '', 'net' => '', 'host_group' => '');
list($alarm_list, $count) = Alarm::get_list($conn, $criteria);
$alarm_string = '';
foreach ($alarm_list as $alarm) {
$desc_alarm = Util::translate_alarm($conn, $alarm->get_sid_name(), $alarm);
$desc_alarm = html_entity_decode(str_replace("'", "\\'", $desc_alarm));
$desc_alarm = str_replace('"', """, $desc_alarm);
$desc_alarm = str_replace('—', "-", $desc_alarm);
$desc_alarm = Util::js_entities($desc_alarm);
if ($alarm_string != '') {
$alarm_string .= '|';
}
$alarm_string .= $desc_alarm;
}
$data['new_alarms_desc'] = $alarm_string;
}
$return['error'] = FALSE;
$return['output'] = $data;
return $return;
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:34,代码来源:sidebar_ajax.php
示例8: actionBuyApi
public function actionBuyApi($item_id, $num)
{
$itemList = Util::loadConfig('items');
$item = $itemList[$item_id];
if (isset($item)) {
$user = User::model()->findByPk($this->usr_id);
if ($user->gold - $item['price'] * $num < 0) {
throw new PException('余额不足');
} else {
$transaction = Yii::app()->db->beginTransaction();
try {
$user->gold -= $item['price'] * $num;
$items = unserialize($user->items);
if (isset($items[$item_id])) {
$items[$item_id] += $num;
} else {
$items[$item_id] = $num;
}
$user->items = serialize($items);
$user->saveAttributes(array('gold', 'items'));
$transaction->commit();
} catch (Exception $e) {
$transaction->rollback();
throw $e;
}
$this->echoJsonData(array('user_gold' => $user->gold));
}
} else {
throw new PException('商品不存在');
}
}
开发者ID:sr71k,项目名称:pet,代码行数:31,代码来源:ItemController.php
示例9: getAngebote
public function getAngebote($data)
{
if (!$this->loggedIn) {
return "TIMEOUT";
}
$html = "";
$T = new HTMLTable(2);
#, "Bitte wählen Sie einen Lieferschein");
$T->setTableStyle("width:100%;margin-top:10px;");
$T->setColWidth(1, 130);
$T->useForSelection(false);
$T->maxHeight(400);
$AC = anyC::get("GRLBM", "isA", "1");
$AC->addJoinV3("Auftrag", "AuftragID", "=", "AuftragID");
$AC->addAssocV3("UserID", "=", Session::currentUser()->getID());
$AC->addAssocV3("status", "=", "open");
#$AC->addOrderV3("datum", "DESC");
$AC->addOrderV3("nummer", "DESC");
#$AC->setLimitV3(100);
#$AC->addJoinV3("Adresse", "t2.AdresseID", "=", "AdresseID");
$i = 0;
while ($B = $AC->n()) {
$Adresse = new Adresse($B->A("AdresseID"));
$T->addRow(array("<span style=\"font-size:20px;font-weight:bold;\">" . $B->A("prefix") . $B->A("nummer") . "</span><br><span style=\"color:grey;\">" . Util::CLDateParser($B->A("datum")) . "</span>", $Adresse->getHTMLFormattedAddress()));
$T->addCellStyle(1, "vertical-align:top;");
$T->addRowStyle("cursor:pointer;border-bottom:1px solid #ccc;");
#if($i % 2 == 1)
# $T->addRowStyle ("background-color:#eee;");
$T->addRowEvent("click", "\n\t\t\t\t\$(this).addClass('selected');\n\t\t\t\t\n\t\t\t\tCustomerPage.rme('getAuftrag', {GRLBMID: " . $B->getID() . "}, function(transport){ \n\t\t\t\t\t\tif(transport == 'TIMEOUT') { document.location.reload(); return; } \n\t\t\t\t\t\t\$('#contentLeft').html(transport); \n\t\t\t\t\t}, \n\t\t\t\t\tfunction(){},\n\t\t\t\t\t'POST');\n\t\t\t\t\t\n\t\t\t\tCustomerPage.rme('getArtikel', {GRLBMID: " . $B->getID() . ", query : '', KategorieID: ''}, function(transport){ \n\t\t\t\t\t\tif(transport == 'TIMEOUT') { document.location.reload(); return; } \n\t\t\t\t\t\t\$('#contentRight').html(transport); \n\t\t\t\t\t\t\$('.selected').removeClass('selected');\n\t\t\t\t\t\t\$('#frameSelect').hide(); \$('#frameEdit').show();\n\t\t\t\t\t}, \n\t\t\t\t\tfunction(){},\n\t\t\t\t\t'POST');");
$i++;
}
$html .= $T;
return $html;
}
开发者ID:nemiah,项目名称:poolPi,代码行数:34,代码来源:CCAngebot.class.php
示例10: alert
/**
* Método para generar un mensaje de alerta, párametros que puede recibir: "icon: icono", "title: ", "subtext: ", "name: ", "autoOpen: "
* @param type $text
* @param type $params
* @return type
*/
public static function alert($text, $params = '')
{
//Extraigo los parametros
$params = Util::getParams(func_get_args());
$icon = isset($params['icon']) ? $params['icon'] : 'icon-exclamation-sign';
$title = isset($params['title']) ? '<i class="' . $icon . '" style="padding-right:5px; margin-top:5px;"></i>' . $params['title'] : null;
$subtext = isset($params['subtext']) ? "<p style='margin-top: 10px'>{$params['subtext']}</p>" : null;
$name = isset($params['name']) ? trim($params['name'], '()') : "dwModal" . rand(10, 5000);
$autoOpen = isset($params['autoOpen']) ? true : false;
$modal = '<div class="modal hide" id="' . $name . '">';
$modal .= '<div class="modal-header">';
$modal .= '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';
$modal .= $title ? "<h3>{$title}</h3>" : '';
$modal .= '</div>';
$modal .= "<div class=\"modal-body\">{$text} {$subtext}</div>";
$modal .= '<div class="modal-footer">';
$modal .= '<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Aceptar</button>';
$modal .= '</div>';
$modal .= '</div>';
$modal .= '<script type="text/javascript">';
$modal .= "function {$name}() { \$('#{$name}').modal('show'); }; ";
if ($autoOpen) {
$modal .= '$(function(){ ' . $name . '(); });';
}
$modal .= "\$('#{$name}').on('shown', function () { \$('.btn-primary', '#{$name}').focus(); });";
$modal .= '</script>';
return $modal . PHP_EOL;
}
开发者ID:slrondon,项目名称:MikrotikCenter,代码行数:34,代码来源:dw_dialog.php
示例11: process
public static function process()
{
global $neardConfig, $neardApps, $neardTools;
$result = '[git]' . PHP_EOL;
$result .= 'client = \'' . $neardTools->getGit()->getExe() . '\'' . PHP_EOL;
$foundRepos = $neardTools->getGit()->findRepos(true);
if (!empty($foundRepos)) {
// Repositories
$refactorRepos = array();
foreach ($foundRepos as $repo) {
/*$repo = dirname($repo);
if (!in_array($repo, $refactorRepos)) {
$refactorRepos[] = $repo;*/
$result .= 'repositories[] = \'' . Util::formatUnixPath($repo) . '\'' . PHP_EOL;
//}
}
} else {
$result .= 'repositories[] = \'\'' . PHP_EOL;
}
// App
$result .= PHP_EOL . '[app]' . PHP_EOL;
$result .= 'debug = false' . PHP_EOL;
$result .= 'cache = false' . PHP_EOL . PHP_EOL;
// Filetypes
$result .= '[filetypes]' . PHP_EOL;
$result .= '; extension = type' . PHP_EOL;
$result .= '; dist = xml' . PHP_EOL . PHP_EOL;
// Binary filetypes
$result .= '[binary_filetypes]' . PHP_EOL;
$result .= '; extension = true' . PHP_EOL;
$result .= '; svh = false' . PHP_EOL;
$result .= '; map = true' . PHP_EOL . PHP_EOL;
file_put_contents($neardApps->getGitlist()->getConf(), $result);
}
开发者ID:RobertoMalatesta,项目名称:neard,代码行数:34,代码来源:class.tpl.gitlist.php
示例12: assertThat
/**
* Make an assertion and throw {@link Hamcrest\AssertionError} if it fails.
*
* The first parameter may optionally be a string identifying the assertion
* to be included in the failure message.
*
* If the third parameter is not a matcher it is passed to
* {@link Hamcrest\Core\IsEqual#equalTo} to create one.
*
* Example:
* <pre>
* // With an identifier
* assertThat("apple flavour", $apple->flavour(), equalTo("tasty"));
* // Without an identifier
* assertThat($apple->flavour(), equalTo("tasty"));
* // Evaluating a boolean expression
* assertThat("some error", $a > $b);
* assertThat($a > $b);
* </pre>
*/
public static function assertThat()
{
$args = func_get_args();
switch (count($args)) {
case 1:
self::$_count++;
if (!$args[0]) {
throw new AssertionError();
}
break;
case 2:
self::$_count++;
if ($args[1] instanceof Matcher) {
self::doAssert('', $args[0], $args[1]);
} elseif (!$args[1]) {
throw new AssertionError($args[0]);
}
break;
case 3:
self::$_count++;
self::doAssert($args[0], $args[1], Util::wrapValueWithIsEqual($args[2]));
break;
default:
throw new \InvalidArgumentException('assertThat() requires one to three arguments');
}
}
开发者ID:cruni505,项目名称:prestomed,代码行数:46,代码来源:MatcherAssert.php
示例13: __construct
public function __construct($args)
{
global $neardBs, $neardConfig, $neardLang, $neardBins, $neardWinbinder;
if (isset($args[0]) && !empty($args[0])) {
$filePath = $neardBs->getAliasPath() . '/' . $args[0] . '.conf';
$fileContent = file_get_contents($filePath);
if (preg_match('/^Alias \\/' . $args[0] . ' "(.+)"/', $fileContent, $match)) {
$this->initName = $args[0];
$initDest = Util::formatWindowsPath($match[1]);
$apachePortUri = $neardBins->getApache()->getPort() != 80 ? ':' . $neardBins->getApache()->getPort() : '';
$neardWinbinder->reset();
$this->wbWindow = $neardWinbinder->createAppWindow(sprintf($neardLang->getValue(Lang::EDIT_ALIAS_TITLE), $this->initName), 490, 200, WBC_NOTIFY, WBC_KEYDOWN | WBC_KEYUP);
$this->wbLabelName = $neardWinbinder->createLabel($this->wbWindow, $neardLang->getValue(Lang::ALIAS_NAME_LABEL) . ' :', 15, 15, 85, null, WBC_RIGHT);
$this->wbInputName = $neardWinbinder->createInputText($this->wbWindow, $this->initName, 105, 13, 150, null, 20);
$this->wbLabelDest = $neardWinbinder->createLabel($this->wbWindow, $neardLang->getValue(Lang::ALIAS_DEST_LABEL) . ' :', 15, 45, 85, null, WBC_RIGHT);
$this->wbInputDest = $neardWinbinder->createInputText($this->wbWindow, $initDest, 105, 43, 190, null, 20, WBC_READONLY);
$this->wbBtnDest = $neardWinbinder->createButton($this->wbWindow, $neardLang->getValue(Lang::BUTTON_BROWSE), 300, 43, 110);
$this->wbLabelExp = $neardWinbinder->createLabel($this->wbWindow, sprintf($neardLang->getValue(Lang::ALIAS_EXP_LABEL), $apachePortUri, $this->initName, $initDest), 15, 80, 470, 50);
$this->wbProgressBar = $neardWinbinder->createProgressBar($this->wbWindow, self::GAUGE_SAVE + 1, 15, 137, 190);
$this->wbBtnSave = $neardWinbinder->createButton($this->wbWindow, $neardLang->getValue(Lang::BUTTON_SAVE), 215, 132);
$this->wbBtnDelete = $neardWinbinder->createButton($this->wbWindow, $neardLang->getValue(Lang::BUTTON_DELETE), 300, 132);
$this->wbBtnCancel = $neardWinbinder->createButton($this->wbWindow, $neardLang->getValue(Lang::BUTTON_CANCEL), 385, 132);
$neardWinbinder->setHandler($this->wbWindow, $this, 'processWindow');
$neardWinbinder->mainLoop();
$neardWinbinder->reset();
}
}
}
开发者ID:RobertoMalatesta,项目名称:neard,代码行数:28,代码来源:class.action.editAlias.php
示例14: GetGenerator
public function GetGenerator($bytearray = false)
{
if ($bytearray) {
return Util::toByteArray($this->Generator);
}
return $this->Generator->toString();
}
开发者ID:BurakDev,项目名称:BloonJPHP,代码行数:7,代码来源:DiffieHellman.php
示例15: stripMarkup
/**
* Strip markup to show plaintext
* Attention the following code block is an adaption
* of the Active Abstract MediaWiki Plugin
* created by Brion Vibber et. al.
* It is not Public Domain, but has the same license as the MediaWiki
* @param string $text
* @return string
* @access private
*/
public static function stripMarkup($text, $image = 'image', $category = 'Category', $language = 'en')
{
$category = Util::getMediaWikiCategoryNamespace($language);
$image = preg_quote($image, '#');
// $image = preg_quote( $wgContLang->getNsText( NS_IMAGE ), '#' );
$text = preg_replace('/(<ref>.+?<\\/ref>)/s', "", $text);
// remove ref
$text = str_replace("'''", "", $text);
$text = str_replace("''", "", $text);
$text = preg_replace('#<!--.*?-->#s', '', $text);
// HTML-style comments
$text = preg_replace('#</?[a-z0-9]+.*?>#s', '', $text);
// HTML-style tags
$text = preg_replace('#\\[[a-z]+:.*? (.*?)\\]#s', '$1', $text);
// URL links
$text = preg_replace('#\\{\\{\\{.*?\\}\\}\\}#s', '', $text);
// template parameters
//$text = preg_replace( '#\\{\\{.*?\\}\\}#s', '', $text ); // template calls
$text = preg_replace('/\\{{2}((?>[^\\{\\}]+)|(?R))*\\}{2}/x', '', $text);
// search {{....}}
$text = preg_replace('#\\{\\|.*?\\|\\}#s', '', $text);
// tables
$text = preg_replace("#\r\n\t\t\t\\[\\[\r\n\t\t\t\t:?{$image}\\s*:\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t[^][]*\r\n\t\t\t\t\t\t\\[\\[\r\n\t\t\t\t\t\t[^][]*\r\n\t\t\t\t\t\t\\]\\]\r\n\t\t\t\t\t)*\r\n\t\t\t\t[^][]*\r\n\t\t\t\\]\\]#six", '', $text);
// images
$text = preg_replace('#\\[\\[(' . $category . ':.*)\\]\\]#s', '', $text);
// Category Links
$text = preg_replace('#\\[\\[([^|\\]]*\\|)?(.*?)\\]\\]#s', '$2', $text);
// links
$text = preg_replace('#^:.*$#m', '', $text);
// indented lines near start are usually disambigs or notices
//TODO $text = Sanitizer::decodeCharReferences( $text );
return trim($text);
}
开发者ID:ljarray,项目名称:dbpedia,代码行数:43,代码来源:ActiveAbstractExtractor.php
示例16: loadPlugin
public function loadPlugin($app, $folder, $optional = false)
{
if (!file_exists(Util::getRootPath() . "{$app}/{$folder}/plugin.xml") and !$optional) {
throw new Exception("Required plugin {$app}/{$folder} not available (1)");
}
if (!file_exists(Util::getRootPath() . "{$app}/{$folder}/plugin.xml")) {
return false;
}
$xml = new XMLPlugin(Util::getRootPath() . "{$app}/{$folder}/plugin.xml");
$allowedPlugins = Environment::getS("allowedPlugins", false);
$extraPlugins = Environment::getS("pluginsExtra", false);
$allow = false;
if ($allowedPlugins !== false and in_array($xml->registerClassName(), $allowedPlugins)) {
$allow = true;
}
if ($extraPlugins !== false and in_array($xml->registerClassName(), $extraPlugins)) {
$allow = true;
}
if ($allowedPlugins !== false and !$allow) {
if (!$optional) {
throw new Exception("Required plugin {$app}/{$folder} not available (2)");
}
return false;
}
require_once Util::getRootPath() . "{$app}/{$folder}/" . $xml->registerClassName() . ".class.php";
$this->addClassPath(Util::getRootPath() . "{$app}/{$folder}");
return true;
}
开发者ID:nemiah,项目名称:fheME,代码行数:28,代码来源:CCPage.class.php
示例17: getOverviewContent
public function getOverviewContent()
{
$html = "<div class=\"touchHeader\"><p>Uhr</p></div>\n\t\t\t<div style=\"padding:10px;\">";
$html .= "<div id=\"fheOverviewClock\"><span>" . Util::CLWeekdayName(date("w")) . "<br><b>" . date("d") . ". " . Util::CLMonthName(date("m")) . " " . date("Y") . "</b></span><b>" . Util::CLTimeParser(time()) . "</b></div>";
$html .= "</div>";
echo $html;
}
开发者ID:nemiah,项目名称:fheME,代码行数:7,代码来源:mClockGUI.class.php
示例18: merge
public static function merge(array $input, $message_list, $options = array())
{
$context = isset($options['context']) ? $options['context'] : null;
$mixables = array();
foreach (Util::splitDelimList($message_list) as $message) {
if ($result = self::call($message, $context)) {
$mixables = array_merge($mixables, $result);
}
}
while ($mixable = array_shift($mixables)) {
if ($mixable instanceof Declaration) {
$input[] = $mixable;
} else {
list($property, $value) = $mixable;
if ($property === 'mixin') {
$input = Mixin::merge($input, $value, $options);
} elseif (!empty($options['keyed'])) {
$input[$property] = $value;
} else {
$input[] = array($property, $value);
}
}
}
return $input;
}
开发者ID:MrHidalgo,项目名称:css-crush,代码行数:25,代码来源:Mixin.php
示例19: getGroupPrice
/**
* 获取会员组价格
* @param $id int 商品或货品ID
* @param $type string goods:商品; product:货品
* @return float 价格
*/
public function getGroupPrice($id, $type = 'goods')
{
if (!$this->group_id) {
return null;
}
//1,查询特定商品的组价格
$groupPriceDB = new IModel('group_price');
if ($type == 'goods') {
$discountRow = $groupPriceDB->getObj('goods_id = ' . $id . ' and group_id = ' . $this->group_id, 'price');
} else {
$discountRow = $groupPriceDB->getObj('product_id = ' . $id . ' and group_id = ' . $this->group_id, 'price');
}
if ($discountRow) {
return $discountRow['price'];
}
//2,根据会员折扣率计算商品折扣
if ($this->group_discount) {
if ($type == 'goods') {
$goodsDB = new IModel('goods');
$goodsRow = $goodsDB->getObj('id = ' . $id, 'sell_price');
return $goodsRow ? Util::priceFormat($goodsRow['sell_price'] * $this->group_discount) : null;
} else {
$productDB = new IModel('products');
$productRow = $productDB->getObj('id = ' . $id, 'sell_price');
return $productRow ? Util::priceFormat($productRow['sell_price'] * $this->group_discount) : null;
}
}
return null;
}
开发者ID:yongge666,项目名称:sunupedu,代码行数:35,代码来源:countsum.php
示例20: onResponseSent
public function onResponseSent()
{
if (!$this->settings->hasSetting("debug_log") or !$this->environment->request()) {
return;
}
$path = $this->environment->request()->path();
if (count($path) > 0 and strcasecmp($path[0], "debug") == 0) {
return;
}
$log = $this->settings->setting("debug_log");
$handle = @fopen($log, "a");
if (!$handle) {
Logging::logError("Could not write to log file: " . $log);
return;
}
$trace = Logging::getTrace();
try {
foreach ($trace as $d) {
fwrite($handle, Util::toString($d));
}
fclose($handle);
} catch (Exception $e) {
Logging::logError("Could not write to log file: " . $log);
Logging::logException($e);
}
}
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:26,代码来源:KloudspeakerBackend.class.php
注:本文中的Util类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论