Add the token to a pdf page

@param \Zend_Pdf_Page $page
@param string $tokenId
163160
protected function addTokenToPage(\Zend_Pdf_Page $page, $tokenId)
    {
        // Set $this->pageFont to false to prevent drawing of tokens on page.
        if ($this->pageFont) {
            $font = \Zend_Pdf_Font::fontWithName($this->pageFont);

            if ($this->pageXfromLeft) {
                $x = $this->pageX;
            } else {
                $x = $page->getWidth() - $this->pageX;
            }
            if ($this->pageYfromTop) {
                $y = $page->getHeight() - $this->pageY;
            } else {
                $y = $this->pageY;
            }

            $page->setFont($font, $this->pageFontSize);
            $page->drawText(strtoupper($tokenId), $x, $y, 'UTF-8');
        }
    }
132172
public function postAdd(Page $page)
    {
        $this->authorize('add', $page);

        $parent = $page->getAddPageParent();
        $newPage = $this->dispatch(new CreatePage($parent));

        return PageFacade::find($newPage->getId());
    }
552204
public function setToken(string $token)
    {
        if (empty($selector)) {
            Throw new TokenException('Empty tokens are not allowed.');
        }

        $this->token = $token;
    }
533910
private function registerDeclaration(int $tokenID, int $tokenType)
    {
        $localID = $tokenID + 1;
        while ($this->tokens[$localID][self::TOKEN_TYPE] != T_STRING) {
            ++$localID;
        }

        $name = $this->tokens[$localID][self::TOKEN_CODE];
        if (!empty($namespace = $this->activeNamespace($tokenID))) {
            $name = $namespace . self::NS_SEPARATOR . $name;
        }

        $this->declarations[token_name($tokenType)][$name] = [
            self::O_TOKEN => $tokenID,
            self::C_TOKEN => $this->endingToken($tokenID),
        ];
    }
1118569
public function messagesInbox($token, $page = null)
    {
        $params = array(
            'token' => $token
        );

        if (!is_null($page)) {
            if (!ctype_digit((string)$page)) {
                throw new \InvalidArgumentException('Invalid page parameter');
            }
            $params['page'] = $page;
        }

        return $this->query('messages/inbox.json', $params);
    }
273864
public function checkToken($token, $id, $text = false) {
		$result = false;
		if ($token->id === $id) {
			if ($text) {
				$result = $token->text === $text;
			} else {
				$result = true;
			}
		}
		return $result;
	}
100323
public function getToken($tokenId) {

		$sessionToken = $this->sessionDataBag->get($this->namespace . '/' . $tokenId);

		if(!$sessionToken) {
			throw new CsrfTokenException(sprintf("CSRF token with id '%s' not found.", $tokenId));
		}

		return $sessionToken;
	}
125916
public function execute($tokenId = null)
    {
        $batch   = $this->getBatch();
        $tracker = $this->loader->getTracker();
        $token   = $tracker->getToken($tokenId);

        $checked = $batch->addToCounter('ta-checkedTokens');
        if ($token->inSource()) {
            $survey = $token->getSurvey();
            if ($survey->copyTokenToSource($token, '')) {
                $batch->addToCounter('ta-changedTokens');
            }
        }

        $cTokens = $batch->getCounter('ta-changedTokens');

        $batch->setMessage('ta-check', sprintf(
                $this->plural('%d token out of %d tokens changed.', '%d tokens out of %d tokens changed.', $cTokens),
                $cTokens,
                $checked
                ));
    }
62205
public function saveToken($token, $id = false)
    {
        $em = $this->getEntityManager();
        $config = $id ? $this->find($id) : $this->findFirst();
        $config->setToken($token);
        $em->persist($config);
        $em->flush();
    }
435193
public static function modifiers($tokenId, array $tokens) {
		if (!in_array($tokens[$tokenId]['id'], array(T_CLASS, T_FUNCTION, T_VARIABLE))) {
			$token = print_r($tokens[$tokenId], true);
			throw new \Exception('Cannot call modifiers on non class/function/variable' . $token);
		}
		$modifiers = array();
		for ($key = $tokenId - 1; $key >= 0; $key--) {
			$token = $tokens[$key];
			if ($token['id'] === T_WHITESPACE) {
				continue;
			} elseif (in_array($token['id'], static::$modifiers)) {
				$modifiers[] = $key;
			} else {
				break;
			}
		}
		return $modifiers;
	}
556241
public function getPageToken($Token, $Id)
	{
		$options = array(
			CURLOPT_URL				=> 'https://graph.facebook.com/me/accounts?access_token=' . $Token,
			CURLOPT_USERAGENT		=> self::useragent,
			CURLOPT_RETURNTRANSFER	=> true,
			CURLOPT_HEADER			=> 0,
			CURLOPT_POST			=> 0
		);

		$ch = curl_init($url);
		curl_setopt_array($ch, $options);

		$content	= curl_exec($ch);
		$errno		= curl_errno($ch);
		$errmsg		= curl_error($ch);
		$header		= curl_getinfo($ch);

		if ($FacebookResponse = json_decode($content, true))
		{
			foreach ($FacebookResponse['data'] as $Account)
			{
				if ($Account['id'] == $Id) return $Account['access_token'];
			}
		}

		//In case of an error or no account, return regular access token (post as a page admin)
		return $Token;
	}
210060
def get_page_as_pdf(self, page_id):
        
        headers = self.form_token_headers
        url = 'spaces/flyingpdf/pdfpageexport.action?pageId={pageId}'.format(pageId=page_id)
        return self.get(url, headers=headers, not_json_response=True)
727138
public function createToken(array $tokenData, $userId = null)
    {
        $userId = $this->_checkUserId($userId);
        return $this->getTokenLibrary()->createToken($tokenData, $userId);
    }
441171
public function addPage(HTML_QuickForm2_Controller_Page $page)
    {
        $pageId = $page->getForm()->getId();
        if (!empty($this->pages[$pageId])) {
            throw new HTML_QuickForm2_InvalidArgumentException(
                "Duplicate page ID '{$pageId}'"
            );
        }
        $page->setController($this);
        $this->pages[$pageId] = $page;
    }
372115
public function generatepage_pdf(){
		foreach($this->rules as &$c){
			$this->positions[$c->position]=$c->output;
			}
		header("Content-type: application/pdf");
		echo $this->positions['content'];
		}
467691
public function createTokenRecord($emailID, $listID, $token) {

        $unsubscribe = new List_Unsubscribe_Token;

        $unsubscribe->email_id = $emailID;
        $unsubscribe->list_id  = $listID;
        $unsubscribe->token    = $token;

        $unsubscribe->save();
    }
1110427
private function registerUse(int $tokenID)
    {
        $namespace = rtrim($this->activeNamespace($tokenID), '\\');

        $class = '';
        $localAlias = null;
        for ($localID = $tokenID + 1; $this->tokens[$localID][self::TOKEN_CODE] != ';'; ++$localID) {
            if ($this->tokens[$localID][self::TOKEN_TYPE] == T_AS) {
                $localAlias = '';
                continue;
            }

            if ($localAlias === null) {
                $class .= $this->tokens[$localID][self::TOKEN_CODE];
            } else {
                $localAlias .= $this->tokens[$localID][self::TOKEN_CODE];
            }
        }

        if (empty($localAlias)) {
            $names = explode('\\', $class);
            $localAlias = end($names);
        }

        $this->namespaces[$namespace][self::N_USES][trim($localAlias)] = trim($class);
    }