当前位置: 首页>>代码示例>>PHP>>正文


PHP Token::parse方法代码示例

本文整理汇总了PHP中Token::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::parse方法的具体用法?PHP Token::parse怎么用?PHP Token::parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Token的用法示例。


在下文中一共展示了Token::parse方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertPhpToken

 /**
  * @param string $str
  *   String contents of token.
  * @param TokenNode $token
  *   The token returned from Token class method.
  * @param bool $check_contents
  *   (optional) TRUE check the contents.
  */
 protected function assertPhpToken($str, $token, $check_contents = TRUE)
 {
     $expected = $this->parsePhpToken($str);
     $actual = Token::parse($str);
     $this->assertToken($expected, $actual, $check_contents);
     $this->assertToken($expected, $token, $check_contents);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:15,代码来源:TokenTest.php

示例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;
 }
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:25,代码来源:map.class.php

示例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;
 }
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:29,代码来源:mapmosaic.class.php

示例4: GeographPage

require_once "3rdparty/xmlHandler.class.php";
$smarty = new GeographPage();
//you must be logged in to request changes
$USER->mustHavePerm("basic");
$template = 'puploader.tpl';
$cacheid = '';
if (isset($_REQUEST['submit2'])) {
    $cacheid .= 'submit2';
    $smarty->assign('submit2', 1);
    if (isset($_REQUEST['upload_id'])) {
        $smarty->assign('upload_id', $_REQUEST['upload_id']);
    }
}
if (isset($_GET['success'])) {
    $token = new Token();
    if ($token->parse($_GET['t'])) {
        $template = 'puploader_success.tpl';
        $smarty->assign('status', unserialize($token->getValueBinary("s")));
        $smarty->assign('filenames', unserialize($token->getValueBinary("f")));
    }
} elseif (isset($_POST['selected'])) {
    //we dont get the button :(
    $status = array();
    $filenames = array();
    foreach ($_POST['field'] as $key => $value) {
        $uploadmanager = new UploadManager();
        $square = new GridSquare();
        $files_key = str_replace('.', '_', $value);
        $filenames[$key] = $_FILES[$files_key]['name'];
        $ok = $square->setByFullGridRef($_POST['grid_reference'][$key]);
        if ($ok) {
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:31,代码来源:puploader.php

示例5: 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;
 }
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:22,代码来源:rastermap.class.php

示例6: serveImageFromToken

 function serveImageFromToken($tokenstr)
 {
     $token = new Token();
     if ($token->parse($tokenstr)) {
         $this->width = $token->getValue("w");
         $this->height = $token->getValue("h");
         $this->gridimage_id = $token->getValue("i");
         $image = new GridImage($this->gridimage_id);
     } else {
         header("HTTP/1.0 403 Bad Token");
     }
 }
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:12,代码来源:pictureoftheday.class.php

示例7: inEmptyRequestInt

 * 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/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();
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:31,代码来源:markit.php

示例8: Token

     $result->outputEnd();
     break;
     /*
      * 激活验证邮箱
      */
 /*
  * 激活验证邮箱
  */
 case 'verifyMail':
     if (!array_key_exists('active', $_GET)) {
         $result->outputErrResult('001');
     }
     $active = $_GET['active'];
     //获取用户ID
     $tokenObj = new Token();
     if ($tokenObj->parse($active) == FALSE) {
         $result->outputErrResult('005');
     }
     $user_id = $tokenObj->m_userid;
     //验证token是否存在
     $db = new WebTrainDBConnection();
     $emailTokenRS = $db->query("SELECT email_token,user_type FROM pineapple_user WHERE email_token='{$active}' AND user_id='{$tokenObj->m_userid}' LIMIT 1");
     if ($emailTokenRS == FALSE) {
         $db->close();
         $result->outputErrResult('004');
     }
     $emailTokenObj = $emailTokenRS->fetch_object();
     if ($emailTokenObj == NULL) {
         $db->close();
         $result->outputErrResult('005');
     }
开发者ID:yu07,项目名称:Pineapple,代码行数:31,代码来源:UserManager.php

示例9: floor

 $ab = floor($i % 10000);
 $cacheid = "search|{$ab}|{$i}.{$pg}";
 if (!empty($_GET['count'])) {
     $engine->countOnly = 1;
     $cacheid .= ".";
 }
 //what style should we use?
 $style = $USER->getStyle();
 $cacheid .= $style;
 if (!empty($_GET['legacy'])) {
     $cacheid .= "X";
     $smarty->assign('legacy', 1);
 }
 if (!empty($_GET['t'])) {
     $token = new Token();
     if ($token->parse($_GET['t']) && $token->getValue("i") == $i) {
         $smarty->clear_cache($template, $cacheid);
     }
 }
 if (!$smarty->is_cached($template, $cacheid)) {
     dieUnderHighLoad(3, 'search_unavailable.tpl');
     $smarty->assign_by_ref('google_maps_api_key', $CONF['google_maps_api_key']);
     $smarty->register_function("searchbreak", "smarty_function_searchbreak");
     $smarty->register_function("votestars", "smarty_function_votestars");
     $smarty->assign('maincontentclass', 'content_photo' . $style);
     if ($display == 'reveal') {
         $engine->noCache = true;
         $engine->criteria->limit4 = 1;
         //only works in GB
     }
     $smarty->assign('querytime', $engine->Execute($pg));
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:31,代码来源:search.php

示例10: 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);
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:31,代码来源:submissions.php

示例11: 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);
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:31,代码来源:auth.php


注:本文中的Token::parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。