本文整理汇总了PHP中getName函数的典型用法代码示例。如果您正苦于以下问题:PHP getName函数的具体用法?PHP getName怎么用?PHP getName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: randName
function randName()
{
$page = file_get_contents("http://www.behindthename.com/random/random.php?number=3&gender=both&surname=&all=yes");
preg_match_all('/<a class=\\"plain\\" href="([^.])*\\">([^.])*<\\/a>/', $page, $names);
$name = getName($names[0][0], '">', '</a>');
return implode(" ", $name);
}
示例2: createNpc
function createNpc()
{
$trait_table = "npc_traits";
$table = "npc";
$columns = getColumnNames($table);
if (empty($_POST["sex"])) {
$_POST["sex"] = getGender();
}
if (empty($_POST["weight"])) {
$_POST["weight"] = getWeight();
}
if (empty($_POST["feet"]) || empty($_POST["inches"])) {
$_POST["height"] = getHeight();
} else {
$_POST["height"] = $_POST["feet"] * 12 + $_POST["inches"];
}
if (empty($_POST["age"])) {
$_POST["age"] = getAge();
}
if (empty($_POST["first_name"])) {
$_POST["first_name"] = getName();
}
// will add the remaining traits not already added
foreach ($columns as $column) {
if (empty($_POST[$column])) {
$_POST[$column] = getTrait($trait_table, $column);
}
}
}
示例3: __invoke
public function __invoke()
{
$today = $this->getDateInThePast(0);
$oneWeekAgo = $this->getDateInThePast(7);
$twoWeeksAgo = $this->getDateInThePast(14);
$threeWeeksAgo = $this->getDateInThePast(21);
$service = $this->adwords->getService('AdGroupService');
$selector = new \Selector();
$selector->predicates = [new \Predicate('Status', 'EQUALS', 'ENABLED'), new \Predicate('CampaignStatus', 'EQUALS', 'ENABLED')];
$selector->orderBy = new \OrderBy('ctr', 'ASCENDING');
$selector->paging = new \Paging(0, \AdWordsConstants::RECOMMENDED_PAGE_SIZE);
do {
$page = $service->get($selector);
if (is_array($page->entries)) {
foreach ($page->entries as $adGroup) {
// Let's look at the trend of the ad group's CTR.
$statsThreeWeeksAgo = $this->getStatsFor($adGroup, $threeWeeksAgo, $twoWeeksAgo);
$statsTwoWeeksAgo = $this->getStatsFor($adGroup, $twoWeeksAgo, $oneWeekAgo);
$statsLastWeek = $this->getStatsFor($adGroup, $oneWeekAgo, $today);
// Week over week, the ad group is declining - record that!
if ($statsLastWeek->getCtr() < $statsTwoWeeksAgo->getCtr() && $statsTwoWeeksAgo->getCtr() < $statsThreeWeeksAgo->getCtr()) {
reportRows . push([adGroup . getCampaign() . getName(), adGroup . getName(), statsLastWeek . getCtr() * 100, statsLastWeek . getCost(), statsTwoWeeksAgo . getCtr() * 100, statsTwoWeeksAgo . getCost(), statsThreeWeeksAgo . getCtr() * 100, statsThreeWeeksAgo . getCost()]);
}
}
}
$selector->paging->startIndex += $selector->paging->numberResults;
} while (!is_null($page->entries));
}
示例4: renderForm
/**
* Create the render form.
*
* @access private
* @return void
*
* @author (c) Etienne de Longeaux <etienne_delongeaux@hotmail.com>
*/
private function renderForm()
{
if ($this->getTypeForm() == "zend") {
self::$_content['_form_'] = $this->_form->render();
} elseif ($this->getTypeForm() == "symfony") {
$response = $this->container->get('templating')->renderResponse($this->container->getParameter('sfynx.auth.theme.layout.admin.form.builder') . ":{$this->_form_template}", array('form' => $this->_form->createView(), 'id_form' => $this->_form->getName(), 'id_block' => $this->_id_block, 'id_widget' => $this->_id_widget, 'form_name' => $this->_form_name));
self::$_content['_form_'] = $response->getContent();
}
}
示例5: pages_createMap
/**
* Интеграция в карту сайта.
*
* @param object &$treemap Объект дерева карты сайта.
* @param string $section Полный строковой идентификатор раздела.
* @param string $caption Название раздела.
*/
function pages_createMap(&$treemap, $section, $caption = "")
{
if (A::$OPTIONS['mainsection'] == getName($section)) {
pages_createSubMap($treemap, $section, $caption, 0, true);
} else {
$treemap->items[$section] = new SiteMap_Box($caption, getSectionLink($section));
pages_createSubMap($treemap->items[$section], $section, $caption);
}
}
示例6: createRows
function createRows()
{
$dbh = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD);
$user_insert = <<<EOF
insert into users
(id, active, approved, username, display_name, email)
values
(:id, 1, 1, :username, :full_name, :email)
EOF;
$user_stmt = $dbh->prepare($user_insert);
$user_stmt->bindParam(':id', $user_id);
$user_stmt->bindParam(':username', $username);
$user_stmt->bindParam(':full_name', $full_name);
$user_stmt->bindParam(':email', $email);
$group_insert = <<<EOF
insert into users_groups
(id, active, name, user_id)
values
(:id, 1, :username, :user_id)
EOF;
$group_stmt = $dbh->prepare($group_insert);
$group_stmt->bindParam(':id', $group_id);
$group_stmt->bindParam(':username', $username);
$group_stmt->bindParam(':user_id', $user_id);
$student_insert = <<<EOF
insert into tg_student
(user_id, first_name, last_name)
values
(:user_id, :first_name, :last_name)
EOF;
$student_stmt = $dbh->prepare($student_insert);
$student_stmt->bindParam(':user_id', $user_id);
$student_stmt->bindParam(':first_name', $first_name);
$student_stmt->bindParam(':last_name', $last_name);
$user_id_result = $dbh->query('select id from users_seq', PDO::FETCH_ASSOC);
$lastUserId = $user_id_result->fetchColumn();
$group_id_result = $dbh->query('select id from users_groups_seq', PDO::FETCH_ASSOC);
$lastGroupId = $group_id_result->fetchColumn();
for ($i = 1; $i <= STUDENT_LIMIT; $i++) {
$user_id = $lastUserId + $i;
$group_id = $lastGroupId + $i;
$first_name = getName(1);
$last_name = getName(2);
$full_name = "{$first_name} {$last_name}";
$username = makeUsername($first_name, $last_name);
$email = $username . '@appstate.edu';
$user_stmt->execute();
$group_stmt->execute();
$student_stmt->execute();
echo "Created user {$username}\n";
}
$user_seq_stmt = 'update users_seq set id=' . $user_id;
$dbh->exec($user_seq_stmt);
$group_seq_stmt = 'update users_groups_seq set id=' . $group_id;
$dbh->exec($group_seq_stmt);
}
示例7: createData
/**
* Формирование данных доступных в шаблоне.
*/
function createData()
{
static $banners = array();
static $purl = null;
if (is_null($purl)) {
$purl = parse_url(urldecode(getenv('REQUEST_URI')));
}
$time = time();
$this->params['idcat'] = (int) $this->params['idcat'];
$unp = $this->structure . '|' . $this->params['idcat'] . '|' . $this->params['random'];
if (!isset($banners[$unp])) {
$banners[$unp] = A::$DB->_getAll("\r\r\n\tSELECT * FROM {$this->structure}\r\r\n\tWHERE idcat={$this->params['idcat']} AND active='Y' AND (date='N' OR (date='Y' AND date1<{$time} AND date2>{$time}))\r\r\n\tORDER BY " . (!empty($this->params['random']) ? "RAND()" : "sort"));
}
foreach ($banners[$unp] as $i => $row) {
$show = empty($row['show']) && empty($row['showurl']);
if (!$show && !empty($row['show'])) {
$row['show'] = unserialize($row['show']);
if (in_array(SECTION_ID, $row['show'])) {
$show = true;
}
}
if (!$show && !empty($row['showurl'])) {
$row['showurl'] = explode("\n", $row['showurl']);
foreach ($row['showurl'] as $url) {
if (!$show) {
$puri = parse_url(trim($url));
if (empty($puri['path']) || mb_strpos($purl['path'], $puri['path']) === 0) {
$show = true;
}
if ($show && !empty($puri['query'])) {
parse_str($puri['query'], $query);
if ($query) {
foreach ($query as $name => $value) {
if (!isset($_GET[$name]) || is_array($value) && !in_array($_GET[$name], $value) || !is_array($value) && $_GET[$name] != $value) {
$show = false;
}
}
}
}
}
}
}
if ($show) {
$banner = $row;
unset($banners[$unp][$i]);
break;
}
}
if (!empty($banner)) {
$banner['link'] = "/getfile/" . getName($this->structure) . "/click/?id=" . $banner['id'];
$this->Assign("banner", $banner);
A::$DB->_execute("UPDATE {$this->structure} SET views=views+1 WHERE id=" . $banner['id']);
} else {
$this->template = "";
}
}
示例8: load_content
function load_content($id)
{
$data['id'] = $id;
$sess_id = sessId();
$data['sess_name'] = getName(sessId());
$data['buddy_name'] = getName($id);
$q = "SELECT *\n FROM chat\n WHERE (sender_id = '{$sess_id}' AND receiver_id = '{$id}')\n OR (sender_id = '{$id}' AND receiver_id = '{$sess_id}')\n order by sent_on desc\n limit 10\n ";
$data['message'] = $this->db->query($q);
//lastq();
$data['photo'] = '';
$data['photo_chat'] = '';
$this->db->where('sender_id', $id)->update('chat', array('is_read' => 1));
$this->load->view('chat/content', $data);
}
示例9: validateSession
/**
* validateSession()
*
* Returns true if a session has already been created in an
* attempt to prevent abuse of the listener.
*/
function validateSession()
{
global $A;
// Activity object
global $name;
$name = getName();
if (cookieVar(LACE_SESSION_COOKIE) === false && !$A->keyExists($name)) {
joinMessage($name);
}
$A->update($name);
setcookie(LACE_SESSION_COOKIE, getCookieString(), time() + 600, LACE_URL_REL);
setcookie(LACE_NAME_COOKIE, $name, time() + 2592000, LACE_URL_REL);
return true;
}
示例10: getName
function getName($min, $max, $row)
{
$n = rand($min, $max);
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $n; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
if (Mysql::alreadyExists($row, $randomString)) {
getName($n, $row);
} else {
return $randomString;
}
}
示例11: createVCard
function createVCard($array)
{
$return = 'BEGIN:VCARD' . PHP_EOL;
$return .= 'VERSION:2.1' . PHP_EOL;
$return .= getName($array) . PHP_EOL;
$return .= getFormatedName($array) . PHP_EOL;
$return .= getPhoto($array);
$return .= getTelephonePrivate($array);
$return .= getMobilePrivate($array);
//$return .= 'TEL;WORK;VOICE:(0221) 9999123' . PHP_EOL;
//$return .= 'TEL;HOME;VOICE:(0221) 1234567' . PHP_EOL;
$return .= getAddress($array);
$return .= getEmail($array);
$return .= date('Y-m-d H:i:s') . PHP_EOL;
$return .= 'END:VCARD' . PHP_EOL;
return $return;
}
示例12: send_notification
function send_notification($id)
{
permissionUser();
$url = base_url() . $this->file_name . '/detail/' . $id;
$subject = 'Pengajuan Work Order';
$isi = getName(sessId()) . " membuat Work Order, Untuk melihat detail silakan <a href={$url}> KLIK DISINI </a>.";
$no = getValue('no', $this->table_name, array('id' => 'where/' . $id));
//SEND NOTIFICATION TO PRODUCTION
$group_id = array('8');
$user_id = $this->db->select('user_id')->where_in('group_id', $group_id)->get('users_groups')->result();
foreach ($user_id as $u) {
$data = array('sender_id' => sessId(), 'receiver_id' => $u->user_id, 'sent_on' => dateNow(), 'judul' => $subject, 'isi' => $isi, 'no' => $no, 'url' => $url);
$this->db->insert('notifikasi', $data);
$this->send_email(getEmail($u->user_id), $subject, $isi);
}
return TRUE;
}
示例13: execute
/**
* @param string $command_string
*/
public function execute()
{
if (!$command . validate()) {
printError(array($cli_exec, $command . getName()), 'Incorrect command syntax');
print $command . shortUsage();
exit(1);
}
try {
$command . execute();
} catch (Zend_Console_CommandExecutionException $e) {
printError(array($cli_exec, $e . getErrPath(), $e . getErrMsg()));
exit(1);
}
/**
* As far as we know, everything is A-OK
*/
exit(0);
}
示例14: logout
/**
* Logs the user out
*/
function logout($ID, $notime = false)
{
global $con;
$active = getActive($ID);
//boolean - if the user is active
$name = getName($ID);
// get the user's name
if (!$active) {
$_SESSION['loginerror'] = "alreadysignedout";
redirect();
} else {
$result = mysqli_query($con, "UPDATE students SET ACTIVE = 0 WHERE ID = '{$ID}'");
if (!$result) {
fancydie('Could not set active to false, ' . mysqli_error($con));
}
$result = mysqli_query($con, "UPDATE logs SET DATEOUT = now() WHERE DATEOUT = '0000-00-00 00:00:00' AND ID = '{$ID}'");
if (!$result) {
fancydie('Could not update logs, ' . mysqli_error($con));
}
if (!$notime) {
$result = mysqli_query($con, "SELECT DATEIN,DATEOUT FROM logs WHERE ID = '{$ID}' ORDER BY NUM desc");
if (!$result) {
fancydie('Could not fetch log data, ' . mysqli_error($con));
}
$row = mysqli_fetch_array($result);
$datein = $row['DATEIN'];
$dateout = $row['DATEOUT'];
$sessiontime = strtotime($dateout) - strtotime($datein);
//get current time spent on team
$result = mysqli_query($con, "SELECT TOTALTIME FROM students WHERE ID = '{$ID}'");
if (!$result) {
fancydie('Could not get total time, ' . mysqli_error($con));
}
$row = mysqli_fetch_array($result);
$totaltime = $row['TOTALTIME'] + $sessiontime;
//new total time
$result = mysqli_query($con, "UPDATE students SET TOTALTIME = '{$totaltime}' WHERE ID = '{$ID}'");
if (!$result) {
fancydie('Could not set total time, ' . mysqli_error($con));
}
}
}
}
示例15: filter
function filter($host, $path, $whitelistName)
{
$whitelist_prefix = "/disk2/qatest/svn_code/qa/WebFramework/htdocs/m_smallTools/m_exceptionFilter/data/";
// echo $whitelist_prefix;
$fileName = getName();
// echo $fileName."<hr/>";
//将文件sed处理后放到该磁盘的test/exceptionFilter目录下
$sedToPath = getSedToPath($path);
$mkdirCmd = "ssh " . $host . " \"mkdir -p " . $sedToPath . "\"";
// echo $mkdirCmd."<hr>";
system($mkdirCmd);
//对文件进行一遍sed过滤,将所有Exception和Error所在的行的行号以及内容存储到tmpE.log中
$filterCmd = "ssh " . $host . " \" sed -n -e '/Exception/I {=;p;b}' -e '/Error/I {=;p}' " . $path . " > " . $sedToPath . $fileName . " \"";
// echo $filterCmd."<hr/>";
system($filterCmd);
//将数据拷贝到本地data目录下
$copyCmd = "scp " . $host . ":" . $sedToPath . $fileName . " " . $whitelist_prefix;
// echo $copyCmd."<hr>";
system($copyCmd);
//删掉原机器上的tmp文件
$deleteCmd = "ssh " . $host . " \" rm " . $sedToPath . $fileName . " \"";
// echo $deleteCmd."<hr>";
system($deleteCmd);
$inFile = $whitelist_prefix . $fileName;
// $whitelist = $whitelist_prefix .$whitelistName;
// echo 'white list :'.$whitelist;
if ($whitelistName != "") {
// echo 'new a ExceptionFilter<hr/>';
$exceptionFilter = new ExceptionFilter($whitelistName);
// echo 'start to get filter result...<hr/>';
$result = $exceptionFilter->getFilterResult($inFile);
$deleteDataCmd = "rm ../data/" . $fileName;
system($deleteDataCmd);
//echo $result;
return $result;
} else {
echo 'whitelist:' . $whitelistName . ' is not exist.';
$deleteDataCmd = "rm ../data/" . $fileName;
system($deleteDataCmd);
}
}