本文整理汇总了PHP中Token::hasValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::hasValue方法的具体用法?PHP Token::hasValue怎么用?PHP Token::hasValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::hasValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isSameAs
/**
* @param Token $token
*
* @return bool
*/
public function isSameAs(Token $token)
{
$hasNumberWildcard = $this->hasNumber() && $token->hasNumber();
if ($hasNumberWildcard && $this->number !== $token->number) {
return false;
}
$hasValueWildcard = $this->hasValue() && $token->hasValue();
if ($hasValueWildcard && $this->value !== $token->value) {
return false;
}
$hasLineNumberWildcard = $this->hasLineNumber() && $token->hasLineNumber();
if ($hasLineNumberWildcard && $this->lineNumber !== $token->lineNumber) {
return false;
}
return true;
}
示例2: setToken
/**
* Initialise class from a token
* @access public
*/
function setToken($tokenstr)
{
$ok = false;
$token = new Token();
if ($token->parse($tokenstr)) {
$ok = $token->hasValue("x") && $token->hasValue("y") && $token->hasValue("w") && $token->hasValue("h") && $token->hasValue("s");
if ($ok) {
$this->setOrigin($token->getValue("x"), $token->getValue("y"));
$this->setImageSize($token->getValue("w"), $token->getValue("h"));
$this->setScale($token->getValue("s"));
$this->type_or_user = $token->hasValue("t") ? $token->getValue("t") : 0;
if ($token->hasValue("r")) {
$this->reference_index = $token->getValue("r");
}
if ($token->hasValue("p")) {
$this->setPalette($token->getValue("p"));
}
}
}
return $ok;
}
示例3: setToken
/**
* Initialise class from a token
* @access public
*/
function setToken($tokenstr, $allowWithoutMosaic = false)
{
$ok = false;
$token = new Token();
if ($token->parse($tokenstr)) {
$ok = $token->hasValue("x") && $token->hasValue("y") && $token->hasValue("w") && $token->hasValue("h") && $token->hasValue("s") && ($allowWithoutMosaic || $token->hasValue("f"));
if ($ok) {
$this->setOrigin($token->getValue("x"), $token->getValue("y"));
$this->setMosaicSize($token->getValue("w"), $token->getValue("h"));
$this->setScale($token->getValue("s"));
$this->setMosaicFactor($token->hasValue("f") ? $token->getValue("f") : 2);
$this->type_or_user = $token->hasValue("t") ? $token->getValue("t") : 0;
$this->palette = $token->hasValue("p") ? $token->getValue("p") : 0;
} else {
$info = "";
foreach ($token->data as $name => $value) {
$info .= "{$name}={$value} ";
}
$this->_err("setToken: missing elements ({$info})");
}
} else {
$this->_err("setToken: parse failure");
}
return $ok;
}
示例4: setToken
/**
* Initialise class from a token
* @access public
*/
function setToken($tokenstr)
{
$ok = false;
$token = new Token();
if ($token->parse($tokenstr)) {
$ok = $token->hasValue("e") && $token->hasValue("n") && $token->hasValue("s");
if ($ok) {
$this->service = $token->getValue("s");
$this->nateastings = $token->getValue("e") * $this->divisor[$this->service];
$this->natnorthings = $token->getValue("n") * $this->divisor[$this->service];
$this->width = $this->tilewidth[$this->service];
if ($token->hasValue("r")) {
$this->epoch = $token->getValue("r");
}
}
}
return $ok;
}
示例5: loadItems
/**
* load all change items
* @access public
*/
function loadItems()
{
$db =& $this->_getDB();
if ($this->isValid()) {
$this->changes = $db->GetAll("select * from gridimage_ticket_item where gridimage_ticket_id={$this->gridimage_ticket_id}");
if (count($this->changes)) {
$token = new Token();
foreach ($this->changes as $i => $row) {
if (!empty($row['newvalue']) && $row['newvalue'] != -1) {
switch ($row['field']) {
case 'grid_reference':
$token->setValue("g", $row['newvalue']);
break;
case 'photographer_gridref':
$token->setValue("p", $row['newvalue']);
break;
case 'view_direction':
$token->setValue("v", $row['newvalue']);
break;
}
}
}
$count = count($token->data);
if ($count > 0 && !($count == 1 && $token->hasValue('v'))) {
$this->reopenmaptoken = $token->getToken();
}
}
}
}
示例6: inEmptyRequestInt
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
require_once 'geograph/global.inc.php';
require_once 'geograph/gridimage.class.php';
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/searchcriteria.class.php';
init_session();
$rater = inEmptyRequestInt('rater', 0);
$i = inEmptyRequestInt('i', 0);
$l = inEmptyRequestInt('l', 0);
if (isset($_REQUEST['t'])) {
$ok = false;
$token = new Token();
if ($token->parse($_REQUEST['t'])) {
if ($token->hasValue("i")) {
$i = $token->getValue("i");
}
if ($token->hasValue("p")) {
$_GET['page'] = $token->getValue("p");
}
}
}
if (isset($_REQUEST['debug']) && $USER->hasPerm("admin")) {
$token = new Token();
$token->setValue("i", $i);
if (!empty($_GET['page'])) {
$token->setValue("p", $_GET['page']);
}
print $token->getToken();
}
示例7: GeographPage
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/token.class.php';
require_once 'geograph/gazetteer.class.php';
init_session();
$smarty = new GeographPage();
$template = 'submit_popup.tpl';
$cacheid = '';
$square = new GridSquare();
if (!$USER->hasPerm("basic") || empty($_GET['t'])) {
$smarty->assign('error', "unable to access page");
$smarty->display($template, $cacheid);
exit;
}
$token = new Token();
if ($token->parse($_GET['t'])) {
if ($token->hasValue("g")) {
$gridref = $token->getValue("g");
}
if ($token->hasValue("p")) {
$photographer_gridref = $token->getValue("p");
}
if ($token->hasValue("v")) {
$view_direction = $token->getValue("v");
}
}
$grid_given = false;
$grid_ok = false;
$pgrid_given = false;
$pgrid_ok = false;
if (!empty($gridref)) {
$grid_given = true;
示例8: GeographPage
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
require_once 'geograph/global.inc.php';
require_once 'geograph/imagelist.class.php';
init_session();
$smarty = new GeographPage();
customGZipHandlerStart();
$USER->mustHavePerm("basic");
$template = 'submissions.tpl';
$max_gridimage_id = 0;
$count = 0;
if (!empty($_GET['next'])) {
$token = new Token();
if ($token->parse($_GET['next']) && $token->hasValue("id")) {
$max_gridimage_id = intval($token->getValue("id"));
$count = intval($token->getValue("c"));
} else {
die("invalid token");
}
}
$ab = floor($USER->user_id / 10000);
$cacheid = "user{$ab}|{$USER->user_id}|{$max_gridimage_id}";
//what style should we use?
$style = $USER->getStyle();
if ($smarty->caching) {
$smarty->caching = 2;
// lifetime is per cache
$smarty->cache_lifetime = 300;
customExpiresHeader(300, false, true);
示例9: Token
$token = new Token();
if (isset($_GET['a']) && $token->parse($_GET['a']) && $token->hasValue('i')) {
$id = $token->getValue('i');
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
die('Database connection failed');
}
if (!($apikey = $db->GetOne("select apikey from apikeys where enabled = 1 and id = " . $db->Quote($id)))) {
die("invalid 'API Key', if you are not the developer you should contact them to correct this");
}
} else {
die("invalid 'Access Key', if you are not the developer you should contact them to correct this");
}
$token = new Token();
$token->magic = md5($CONF['token_secret'] . $apikey);
if (isset($_GET['t']) && $token->parse($_GET['t']) && $token->hasValue('callback')) {
$callback = $token->getValue('callback');
$action = $token->getValue('action');
$smarty->assign('callback', $callback);
$smarty->assign('action', $action);
$token = new Token();
$token->magic = md5($CONF['token_secret'] . $apikey);
$token->setValue("k", $apikey);
//just to prove to THEM we know who they are
$token->setValue("user_id", $USER->user_id);
$token->setValue("realname", $USER->realname);
if (!empty($USER->nickname)) {
$token->setValue("nickname", $USER->nickname);
}
$final_url = "{$callback}?t=" . $token->getToken();
$smarty->assign('final_url', $final_url);