Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90499848
utils.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 2, 05:54
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Nov 4, 05:54 (2 d)
Engine
blob
Format
Raw Data
Handle
22087500
Attached To
rPH Phabricator
utils.php
View Options
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Include a CSS or JS static resource by name. This function records a
* dependency for the current page, so when a response is generated it can be
* included. You can call this method from any context, and it is recommended
* you invoke it as close to the actual dependency as possible so that page
* dependencies are minimized.
*
* For more information, see @{article:Adding New CSS and JS}.
*
* @param string Name of the celerity module to include. This is whatever you
* annotated as "@provides" in the file.
* @return void
*
* @group celerity
*/
function
require_celerity_resource
(
$symbol
)
{
$response
=
CelerityAPI
::
getStaticResourceResponse
();
$response
->
requireResource
(
$symbol
);
}
/**
* Generate a node ID which is guaranteed to be unique for the current page,
* even across Ajax requests. You should use this method to generate IDs for
* nodes which require a uniqueness guarantee.
*
* @return string A string appropriate for use as an 'id' attribute on a DOM
* node. It is guaranteed to be unique for the current page, even
* if the current request is a subsequent Ajax request.
*
* @group celerity
*/
function
celerity_generate_unique_node_id
()
{
static
$uniq
=
0
;
$response
=
CelerityAPI
::
getStaticResourceResponse
();
$block
=
$response
->
getMetadataBlock
();
return
'UQ'
.
$block
.
'_'
.(
$uniq
++);
}
Event Timeline
Log In to Comment