本文整理汇总了PHP中uniqID函数的典型用法代码示例。如果您正苦于以下问题:PHP uniqID函数的具体用法?PHP uniqID怎么用?PHP uniqID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uniqID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test
public function test()
{
eval('function hook_tokens($type, $tokens, array $data = array(), array $options = array()) {}');
$config = ['hook' => 'tokens', 'module' => 'system'];
$module_handler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
$plugin = new ImplementHook($config, uniqID(), [], $module_handler);
$plugin->setTarget($this->target);
$plugin->execute();
$module = $this->target->getPath('.module');
$function = $this->target->open($module)->children(Filter::isFunction('foo_tokens'))->get(0);
$this->assertInstanceOf('\\Pharborist\\Functions\\FunctionDeclarationNode', $function);
$this->assertEquals('foo_tokens', $function->getName()->getText());
$parameters = $function->getParameters();
$this->assertCount(4, $parameters);
$this->assertNull($parameters[0]->getTypeHint());
$this->assertEquals('type', $parameters[0]->getName());
$this->assertNull($parameters[0]->getValue());
$this->assertNull($parameters[1]->getTypeHint());
$this->assertEquals('tokens', $parameters[1]->getName());
$this->assertNull($parameters[1]->getValue());
$this->assertInstanceOf('\\Pharborist\\TokenNode', $parameters[2]->getTypeHint());
$this->assertSame(T_ARRAY, $parameters[2]->getTypeHint()->getType());
$this->assertEquals('data', $parameters[2]->getName());
$this->assertInstanceOf('\\Pharborist\\Types\\ArrayNode', $parameters[2]->getValue());
$this->assertInstanceOf('\\Pharborist\\TokenNode', $parameters[3]->getTypeHint());
$this->assertSame(T_ARRAY, $parameters[3]->getTypeHint()->getType());
$this->assertEquals('options', $parameters[3]->getName());
$this->assertInstanceOf('\\Pharborist\\Types\\ArrayNode', $parameters[3]->getValue());
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:29,代码来源:ImplementHookTest.php
示例2: test
public function test()
{
$indexer = new Classes([], 'class', [], $this->db, $this->target);
$indexer->build();
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->with('class')->willReturn($indexer);
$config = ['class' => '\\Drupal\\foo\\MyBaz', 'destination' => '~/src/MyBaz.php', 'parent' => '\\Drupal\\Core\\Baz\\BazBase', 'interfaces' => ['\\Drupal\\Core\\Baz\\BazInterface', '\\Drupal\\Core\\Executable\\ExecutableInterface'], 'doc' => 'This is my bazzifier. There are many like it, but this one is mine.'];
$plugin = new CreateClass($config, uniqID(), []);
$plugin->setTarget($this->target);
$plugin->execute();
$this->assertTrue($indexer->has('MyBaz'));
$classes = $indexer->get('MyBaz');
$this->assertCount(1, $classes);
/** @var \Pharborist\Objects\ClassNode $class */
$class = $classes->get(0);
$this->assertInstanceOf('\\Pharborist\\Objects\\ClassNode', $class);
$this->assertEquals('\\Drupal\\foo\\MyBaz', $class->getName()->getAbsolutePath());
$this->assertEquals('MyBaz', $class->getName()->getText());
$parent = $class->getExtends();
$this->assertInstanceOf('\\Pharborist\\Namespaces\\NameNode', $parent);
$this->assertEquals('BazBase', $parent->getText());
return;
$interfaces = $class->getImplementList();
$this->assertCount(2, $interfaces->getItems());
$this->assertEquals('BazInterface', $interfaces->get(0)->getText());
$this->assertEquals('ExecutableInterface', $interfaces->get(1)->getText());
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:26,代码来源:CreateClassTest.php
示例3: test
public function test()
{
$class = ClassNode::create('Foobaz');
$indexer = $this->getMock('\\Drupal\\drupalmoduleupgrader\\IndexerInterface');
$indexer->method('get')->with('Foobaz')->willReturn(new NodeCollection([$class]));
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->with('class')->willReturn($indexer);
$config = ['definition' => '\\Drupal\\Core\\Block\\BlockPluginInterface::blockForm', 'target' => 'Foobaz'];
$plugin = new Implement($config, uniqID(), []);
$plugin->setTarget($this->target);
try {
// We expect a CodeManagerIOException because we're implementing the
// method on a class that is not officially part of the target's code.
// That's OK, though.
$plugin->execute();
} catch (IOException $e) {
}
$this->assertTrue($class->hasMethod('blockForm'));
$method = $class->getMethod('blockForm');
$this->assertInstanceOf('\\Pharborist\\Objects\\ClassMethodNode', $method);
$parameters = $method->getParameters();
$this->assertCount(2, $parameters);
$this->assertEquals($parameters[0]->getName(), 'form');
$this->assertNull($parameters[0]->getTypeHint());
$this->assertEquals($parameters[1]->getName(), 'form_state');
$type = $parameters[1]->getTypeHint();
$this->assertInstanceOf('\\Pharborist\\Namespaces\\NameNode', $type);
$this->assertEquals('Drupal\\Core\\Form\\FormStateInterface', $type->getText());
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:28,代码来源:ImplementTest.php
示例4: __construct
public function __construct()
{
parent::__construct();
$this->abonnements = new \Doctrine\Common\Collections\ArrayCollection();
$this->favorites = new \Doctrine\Common\Collections\ArrayCollection();
$this->playlists = new \Doctrine\Common\Collections\ArrayCollection();
$this->comments = new \Doctrine\Common\Collections\ArrayCollection();
$this->uniqID = uniqID();
}
开发者ID:OKTOTV,项目名称:FLUX2,代码行数:9,代码来源:User.php
示例5: test
public function test()
{
$class = ClassNode::create('Wambooli');
$indexer = $this->getMock('\\Drupal\\drupalmoduleupgrader\\IndexerInterface');
$indexer->method('get')->with('Wambooli')->willReturn(new NodeCollection([$class]));
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->with('class')->willReturn($indexer);
$config = ['source' => 'Wambooli', 'destination' => 'Drupal\\foo\\Wambooli'];
$plugin = new PSR4($config, uniqID(), []);
$plugin->setTarget($this->target);
$plugin->execute();
$url = $this->target->getPath('src/Wambooli.php');
$this->assertFileExists($url);
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:13,代码来源:PSR4Test.php
示例6: test
public function test()
{
$config = ['key' => 'foo.settings/baz', 'value' => 'wambooli', 'in' => '~/foo.settings.yml'];
$plugin = new Define($config, uniqID(), []);
$plugin->setTarget($this->target);
$plugin->execute();
$url = $this->dir->getChild('foo.settings.yml')->url();
$this->assertFileExists($url);
$expected = <<<END
foo.settings:
baz: wambooli
END;
$this->assertEquals($expected, file_get_contents($url));
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:15,代码来源:DefineTest.php
示例7: test
public function test()
{
$permissions = ['bazify' => ['title' => 'Do snazzy bazzy things']];
$indexer = $this->getMockBuilder('\\Drupal\\drupalmoduleupgrader\\Plugin\\DMU\\Indexer\\Functions')->disableOriginalConstructor()->getMock();
$indexer->method('has')->with('hook_permission')->willReturn(TRUE);
$indexer->method('hasExecutable')->with('hook_permission')->willReturn(TRUE);
$indexer->method('execute')->with('hook_permission')->willReturn($permissions);
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->with('function')->willReturn($indexer);
$config = ['hook' => 'permission', 'destination' => '~/foo.permissions.yml'];
$plugin = new HookToYAML($config, uniqID(), []);
$plugin->setTarget($this->target);
$plugin->execute();
$url = $this->dir->getChild('foo.permissions.yml')->url();
$this->assertFileExists($url);
$this->assertSame(YAML::encode($permissions), file_get_contents($url));
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:16,代码来源:HookToYAMLTest.php
示例8: queueObject
public function queueObject($object)
{
global $redis;
$wrapped = serialize($object);
$allQueues = new RedisTtlSortedSet('redisQ:allQueues');
$objectQueues = new RedisTtlSortedSet('objectQueues');
$queues = $allQueues->getMembers();
$multi = $redis->multi();
// Store an instance of the object
$objectID = 'redisQ:objectID:' . uniqID() . md5($wrapped);
$objectQueues->add(time(), $objectID);
$multi->setex($objectID, 9600, $wrapped);
// Add objectID to all queues
foreach ($queues as $queueID) {
$multi->lPush($queueID, $objectID);
$multi->expire($queueID, 9600);
}
$multi->exec();
}
开发者ID:zkillboard,项目名称:redisq,代码行数:19,代码来源:RedisQ.php
示例9: smarty_function_html_tabs
/**
* Smarty {html_tabs} function plugin
*
* Type: function<br>
* Name: html_tabs<br>
* Date: Jun 6, 2004<br>
* Purpose: return tabs<br>
* Input:<br>
* - tabs = array of tab objects (required)
* - path = path to pages (optional, default "")
* - selected = selected tab (optional, default actual page)
* - no_select = no tab is selected (optional, default false)
* - anchor_extra_html = extra html into <A> tags (optional , default '')
* - div_id = ID attr of main div element (optional, default "swTabs")
* - div_class = CLASS attr of main div element (optional, default none)
*
* Examples: {html_tabs tabs=$tabs}
* @author Karel Kozlik <[email protected]>
* @version 1.0
* @param array
* @param Smarty
* @return string
*/
function smarty_function_html_tabs($params, &$smarty)
{
global $sess, $_SERVER;
$path = '';
$selected = NULL;
$no_select = false;
$anchor_extra_html = '';
$div_class = '';
extract($params);
if (empty($tabs)) {
$smarty->trigger_error("html_tabs: missing 'tabs' parameter", E_USER_NOTICE);
return;
}
if (!$selected) {
$selected = basename($_SERVER['SCRIPT_FILENAME']);
}
if (!isset($div_id)) {
$div_id = "swTabs";
}
$out = '<div ';
if ($div_id) {
$out .= 'id="' . $div_id . '" ';
}
if ($div_class) {
$out .= 'class="' . $div_class . '" ';
}
$out .= '><ul>';
foreach ($tabs as $i => $value) {
if ($value->is_enabled()) {
if ($value->get_page() == $selected and !$no_select) {
$out .= '<li class="swActiveTab"><div class="swTabsL"></div><strong><span>' . $value->get_name() . '</span></strong><div class="swTabsR"></div></li>';
} else {
$separator = strpos($path . $value->get_page(), "?") ? "&" : "?";
$out .= '<li><div class="swTabsL"></div><a href="' . htmlspecialchars($sess->url($path . $value->get_page() . $separator . "kvrk=" . uniqID("")), ENT_QUOTES) . '" ' . $anchor_extra_html . ' class="tabl"><span>' . $value->get_name() . '</span></a><div class="swTabsR"></div></li>';
}
//if ($value->get_page()==$selected)
}
// if ($value->is_enabled())
}
//foreach
$out .= '</ul></div>';
return $out;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:66,代码来源:function.html_tabs.php
示例10: action_default
function action_default(&$errors)
{
global $data, $sess, $sess_ms_act_row;
$this->controler->set_timezone();
$data->set_act_row($sess_ms_act_row);
if (false === ($this->im = $data->get_IMs($this->user_id->get_uid()))) {
return false;
}
$this->pager['url'] = $_SERVER['PHP_SELF'] . "?kvrk=" . uniqid("") . "&act_row=";
$this->pager['pos'] = $data->get_act_row();
$this->pager['items'] = $data->get_num_rows();
$this->pager['limit'] = $data->get_showed_rows();
$this->pager['from'] = $data->get_res_from();
$this->pager['to'] = $data->get_res_to();
foreach ($this->im as $k => $v) {
$this->im[$k]['url_reply'] = $sess->url($this->opt['im_sending_script'] . "?kvrk=" . uniqid("") . "&im_sip_addr=" . rawURLEncode($v['raw_src_addr']));
$this->im[$k]['url_dele'] = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&im_dele_id=" . rawURLEncode($v['mid']));
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:20,代码来源:apu_msilo.php
示例11: testDocComment
public function testDocComment()
{
$class = ClassNode::create('Wambooli');
$class->setDocComment(DocCommentNode::create('Double wambooli!'));
$this->assertInstanceOf('\\Pharborist\\DocCommentNode', $class->getDocComment());
$indexer = $this->getMock('\\Drupal\\drupalmoduleupgrader\\IndexerInterface');
$indexer->method('get')->with('Wambooli')->willReturn(new NodeCollection([$class]));
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->with('class')->willReturn($indexer);
$config = ['type' => 'class', 'id' => 'Wambooli', 'note' => 'You need to rewrite this thing because I said so!'];
$plugin = new Notify($config, uniqID(), []);
$plugin->setTarget($this->target);
$plugin->execute();
$comment = $class->getDocComment();
$this->assertInstanceOf('\\Pharborist\\DocCommentNode', $comment);
$expected = <<<END
Double wambooli!
You need to rewrite this thing because I said so!
END;
$this->assertEquals($expected, $comment->getCommentText());
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:21,代码来源:NotifyTest.php
示例12: test
public function test()
{
$callback = Parser::parseSnippet('function foo_submit(&$form, &$form_state) {}');
$function_indexer = $this->getMock('\\Drupal\\drupalmoduleupgrader\\IndexerInterface');
$function_indexer->method('get')->with('foo_submit')->willReturn(new NodeCollection([$callback]));
$class = ClassNode::create('FooForm');
$class_indexer = $this->getMock('\\Drupal\\drupalmoduleupgrader\\IndexerInterface');
$class_indexer->method('get')->with('FooForm')->willReturn(new NodeCollection([$class]));
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->willReturnCallback(function ($which) use($class_indexer, $function_indexer) {
switch ($which) {
case 'class':
return $class_indexer;
case 'function':
return $function_indexer;
default:
break;
}
});
$config = ['callback' => 'foo_submit', 'destination' => 'FooForm::submitForm'];
$plugin = new FormCallbackToMethod($config, uniqID(), []);
$plugin->setTarget($this->target);
try {
// We expect a CodeManagerIOException because we're implementing the
// method on a class that is not officially part of the target's code.
// That's OK, though.
$plugin->execute();
} catch (IOException $e) {
}
$this->assertTrue($class->hasMethod('submitForm'));
$parameters = $class->getMethod('submitForm')->getParameters();
$this->assertCount(2, $parameters);
$this->assertEquals('form', $parameters[0]->getName());
$this->assertInstanceOf('\\Pharborist\\TokenNode', $parameters[0]->getTypeHint());
$this->assertSame(T_ARRAY, $parameters[0]->getTypeHint()->getType());
$this->assertInstanceOf('\\Pharborist\\TokenNode', $parameters[0]->getReference());
$this->assertEquals('form_state', $parameters[1]->getName());
$this->assertInstanceOf('\\Pharborist\\Namespaces\\NameNode', $parameters[1]->getTypeHint());
$this->assertEquals('Drupal\\Core\\Form\\FormStateInterface', $parameters[1]->getTypeHint()->getText());
$this->assertNull($parameters[1]->getReference());
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:40,代码来源:FormCallbackToMethodTest.php
示例13: test
public function test()
{
$code = <<<'END'
<?php
variable_get('foo');
END;
$this->dir->getChild('foo.module')->setContent(rtrim($code));
$indexer = new FunctionCalls([], 'function', ['exclude' => []], $this->db, $this->target);
$indexer->build();
$this->container->get('plugin.manager.drupalmoduleupgrader.indexer')->method('createInstance')->with('function_call')->willReturn($indexer);
$config = ['type' => 'function_call', 'id' => 'variable_get', 'note' => 'This is no longer kosher!'];
$plugin = new Disable($config, uniqID(), []);
$plugin->setTarget($this->target);
$plugin->execute();
$expected = <<<END
<?php
// This is no longer kosher!
// variable_get('foo');
END;
// trim() makes the test pass. Go figure.
$this->assertEquals($expected, trim($this->dir->getChild('foo.module')->getContent()));
}
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:24,代码来源:DisableTest.php
示例14: pass_values_to_html
/**
* assign variables to smarty
*/
function pass_values_to_html()
{
global $smarty, $sess;
$sort_urls = array();
$get_params = implode("&", $this->get_params);
if ($get_params) {
$get_params = "&" . $get_params;
}
foreach ($this->sort_columns as $v) {
$sort_urls[$v] = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&u_sort_" . $v . "=1" . $get_params);
$smarty->assign_by_ref($this->opt['smarty_vars'] . "_" . $v, $sort_urls[$v]);
}
$smarty->assign_by_ref($this->opt['smarty_vars'], $sort_urls);
$smarty->assign($this->opt['smarty_order'], $this->get_sort_col());
$smarty->assign($this->opt['smarty_dir'], $this->get_sort_dir());
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:19,代码来源:apu_sorter.php
示例15: get_domains
function get_domains(&$errors)
{
global $data, $sess;
$filter = array();
if (is_a($this->filter, "apu_base_class")) {
$filter = $this->filter->get_filter();
// $data->set_act_row($this->filter->get_act_row());
}
$opt = array();
if (false === ($this->assigned_ids = $data->get_domains_of_admin($this->controler->user_id->get_uid(), $opt))) {
return false;
}
$opt = array("filter" => $filter, "return_all" => true, "get_domain_names" => true);
if (false === ($domains = $data->get_domains($opt, $errors))) {
return false;
}
$this->assigned_domains = array();
$this->unassigned_domains = array();
foreach ($domains as $k => $v) {
if ($v['id'] == '0') {
continue;
}
//skip default domain
if (in_array($v['id'], $this->assigned_ids)) {
$domains[$k]['url_unassign'] = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&da_unassign=1&" . $this->controler->domain_to_get_param($v['id']));
$this->assigned_domains[] =& $domains[$k];
} else {
$domains[$k]['url_assign'] = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&da_assign=1&" . $this->controler->domain_to_get_param($v['id']));
$this->unassigned_domains[] =& $domains[$k];
}
}
return true;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:33,代码来源:apu_domain_admin.php
示例16: array
<?php
/**
* Logout
*
* @author Karel Kozlik
* @version $Id: logout.php,v 1.3 2007/02/14 16:36:40 kozlik Exp $
* @package serweb
* @subpackage user_pages
*/
$_phplib_page_open = array("sess" => "phplib_Session");
/** include all others necessary files */
require "prepend.php";
$_SESSION['auth']->logout();
if (isset($sess_admin) and $sess_admin) {
//when admins logged out from user's "my_account page"
$sess->unregister("sess_admin");
Header("Location: " . $sess->url($config->admin_pages_path . "index.php?kvrk=" . uniqID("") . "&logout=1"));
} else {
Header("Location: " . $sess->url("index.php?kvrk=" . uniqID("") . "&logout=1"));
}
$sess->delete();
page_close();
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:23,代码来源:logout.php
示例17: print_tabs
function print_tabs($tabs, $path="", $selected=null){
global $config, $sess, $PATH_TRANSLATED;
if (!$selected){
$selected=basename($PATH_TRANSLATED);
}
?>
<div id="swTabs">
<ul>
<?
foreach($tabs as $i => $value){
if ($value->enabled){
if ($value->page==$selected){?>
<li id="swActiveTab"><div class="swTabsL"></div><strong><?echo $value->name;?></strong><div class="swTabsR"></div></li>
<? }
else{?>
<li><div class="swTabsL"></div><a href="<?$sess->purl($path.$value->page."?kvrk=".uniqID(""));?>" class="tabl"><?echo $value->name;?></a><div class="swTabsR"></div></li>
<? }//if ($value->page==$selected)
}// if ($value->enabled)
} //foreach ?>
</ul>
</div>
<?
} //end function print_tabs
开发者ID:BackupTheBerlios,项目名称:sipums,代码行数:26,代码来源:page.php
示例18: pass_values_to_html
/**
* assign variables to smarty
*/
function pass_values_to_html()
{
global $smarty, $sess;
$smarty->assign_by_ref($this->opt['smarty_action'], $this->smarty_action);
$smarty->assign_by_ref($this->opt['smarty_pager'], $this->pager);
$smarty->assign_by_ref($this->opt['smarty_domains'], $this->domains);
$smarty->assign($this->opt['smarty_url_new_domain'], $sess->url($this->opt['script_create'] . "?kvrk=" . uniqID("") . "&new=1"));
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:11,代码来源:apu_domain_list.php
示例19: pass_values_to_html
function pass_values_to_html()
{
global $smarty, $sess;
if (!$this->acc_res) {
$this->acc_res = array();
}
$smarty->assign_by_ref($this->opt['smarty_pager'], $this->pager);
$smarty->assign_by_ref($this->opt['smarty_result'], $this->acc_res);
$smarty->assign($this->opt['smarty_url_delete'], $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&acc_delete=" . RawURLEncode($this->opt['instance_id']) . "×tamp=" . time()));
$smarty->assign($this->opt['smarty_url_cvs_export'], $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&acc_export=" . RawURLEncode($this->opt['instance_id'])));
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:11,代码来源:apu_accounting.php
示例20: action_edit_layout_file
/**
* perform action edit layout file
*
* @param array $errors array with error messages
* @return array return array of $_GET params fo redirect or FALSE on failure
*/
function action_edit_layout_file(&$errors)
{
global $sess;
$this->smarty_action = "edit_layout";
$this->url_back_to_default = $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&back_to_default_layout=1&filename=" . RawURLEncode($this->filename));
return true;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:13,代码来源:apu_domain_layout.php
注:本文中的uniqID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论