本文整理汇总了PHP中rawurlencode函数的典型用法代码示例。如果您正苦于以下问题:PHP rawurlencode函数的具体用法?PHP rawurlencode怎么用?PHP rawurlencode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rawurlencode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCoordinates
/**
* {@inheritdoc}
*/
public function getCoordinates($street = null, $postal = null, $city = null, $country = null, $fullAddress = null)
{
// Generate a new container.
$objReturn = new Container();
// Set the query string.
$sQuery = $this->getQueryString($street, $postal, $city, $country, $fullAddress);
$objReturn->setSearchParam($sQuery);
$oRequest = null;
$oRequest = new \Request();
$oRequest->send(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
$objReturn->setUri(sprintf($this->strGoogleUrl, rawurlencode($sQuery)));
if ($oRequest->code == 200) {
$aResponse = json_decode($oRequest->response, 1);
if (!empty($aResponse['status']) && $aResponse['status'] == 'OK') {
$objReturn->setLatitude($aResponse['results'][0]['geometry']['location']['lat']);
$objReturn->setLongitude($aResponse['results'][0]['geometry']['location']['lng']);
} elseif (!empty($aResponse['error_message'])) {
$objReturn->setError(true);
$objReturn->setErrorMsg($aResponse['error_message']);
} else {
$objReturn->setError(true);
$objReturn->setErrorMsg($aResponse['Status']['error_message']);
}
} else {
// Okay nothing work. So set all to Error.
$objReturn->setError(true);
$objReturn->setErrorMsg('Could not find coordinates for address "' . $sQuery . '"');
}
return $objReturn;
}
示例2: index_f
public function index_f()
{
if (!$this->popedom["list"]) {
error(P_Lang('您没有权限执行此操作'), '', 'error');
}
$this->phpok_autoload();
$pageid = $this->get($this->config["pageid"], "int");
if (!$pageid) {
$pageid = 1;
}
$keywords = $this->get("keywords");
$pageurl = $this->url("call");
$condition = "";
if ($keywords) {
$this->assign("keywords", $keywords);
$pageurl .= "&keywords=" . rawurlencode($keywords) . "&";
$condition = " (title LIKE '%" . $keywords . "%' OR note LIKE '%" . $keywords . "%' OR identifier LIKE '%" . $keywords . "%') ";
}
$rslist = $this->model('call')->get_list($condition, $pageid);
$this->assign("rslist", $rslist);
$total = $this->model('call')->get_count($condition);
$this->assign("total", $total);
$string = 'home=' . P_Lang('首页') . '&prev=' . P_Lang('上一页') . '&next=' . P_Lang('下一页') . '&last=' . P_Lang('尾页') . '&half=5';
$string .= '&add=' . P_Lang('数量:') . '(total)/(psize)' . P_Lang(',') . P_Lang('页码:') . '(num)/(total_page)&always=1';
$pagelist = phpok_page($pageurl, $total, $pageid, $this->psize, $string);
$this->assign("pagelist", $pagelist);
$attrlist = $this->model('list')->attr_list();
$this->assign("attrlist", $attrlist);
$this->view("phpok_index");
}
示例3: city_magazine_comment_post_forbidden
/**
* Theme a "you can't post comments" notice.
*
* @param $node
* The comment node.
* @ingroup themeable
*/
function city_magazine_comment_post_forbidden($node)
{
global $user;
static $authenticated_post_comments;
if (!$user->uid) {
if (!isset($authenticated_post_comments)) {
// We only output any link if we are certain, that users get permission
// to post comments by logging in. We also locally cache this information.
$authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval'));
}
if ($authenticated_post_comments) {
// We cannot use drupal_get_destination() because these links
// sometimes appear on /node and taxonomy listing pages.
if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$destination = 'destination=' . rawurlencode("comment/reply/{$node->nid}#comment-form");
} else {
$destination = 'destination=' . rawurlencode("node/{$node->nid}#comment-form");
}
if (variable_get('user_register', 1)) {
// Users can register themselves.
// original
//return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">or</span> <a href="@register"><span>register</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
// no register
return t('<a href="@login"><span>Login</span></a> <span class="regulat-text">to post comments</span>', array('@login' => url('user/login', array('query' => $destination))));
} else {
// Only admins can add new users, no public registration.
return t('<a href="@login"><span>Login</span></a> to post comments', array('@login' => url('user/login', array('query' => $destination))));
}
}
}
}
示例4: main
/**
* Processing of clickmenu items
*
* @param object Reference to parent
* @param array Menu items array to modify
* @param string Table name
* @param integer Uid of the record
* @return array Menu item array, returned after modification
* @todo Skinning for icons...
*/
function main(&$backRef, $menuItems, $table, $uid)
{
global $BE_USER, $TCA;
$localItems = array();
if ($backRef->cmLevel && t3lib_div::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
// Show import/export on second level menu OR root level.
$LL = $this->includeLL();
$modUrl = $backRef->backPath . t3lib_extMgm::extRelPath('impexp') . 'app/index.php';
$url = $modUrl . '?tx_impexp[action]=export&id=' . ($table == 'pages' ? $uid : $backRef->rec['pid']);
if ($table == 'pages') {
$url .= '&tx_impexp[pagetree][id]=' . $uid;
$url .= '&tx_impexp[pagetree][levels]=0';
$url .= '&tx_impexp[pagetree][tables][]=_ALL';
} else {
$url .= '&tx_impexp[record][]=' . rawurlencode($table . ':' . $uid);
$url .= '&tx_impexp[external_ref][tables][]=_ALL';
}
$localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-export-t3d')), $backRef->urlRefForCM($url), 1);
if ($table == 'pages') {
$url = $modUrl . '?id=' . $uid . '&table=' . $table . '&tx_impexp[action]=import';
$localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1);
}
}
return array_merge($menuItems, $localItems);
}
示例5: translate
function translate($text, $d = '')
{
$s = 'en';
if ($d == '') {
$d = 'en';
}
if ($d != 'en') {
$lang_pair = urlencode($s . '|' . $d);
$q = rawurlencode($text);
// Google's API translator URL
$url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" . $q . "&langpair=" . $lang_pair;
// Make sure to set CURLOPT_REFERER because Google doesn't like if you leave the referrer out
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.yoursite.com/translate.php");
$body = curl_exec($ch);
curl_close($ch);
$json = json_decode($body, true);
$tranlate = $json['responseData']['translatedText'];
echo $tranlate;
} else {
echo $text;
}
}
示例6: Comet_encode_char
function Comet_encode_char($char)
{
if (strpos(' ~`!@#$%^&*()+=[]\\{}|;\':",./<>?', $char) === false) {
return $char;
}
return rawurlencode($char);
}
示例7: checkAuth
function checkAuth($redirectIfNeeded)
{
// is the user already logged in?
if (isset($_SESSION["uid"]) && $_SESSION["uid"] != "") {
// yes, already logged in
return $_SESSION["uid"];
} else {
if ($redirectIfNeeded) {
// user is not logged in and needs to do so
// send to the login page
// pass the current URL so that we can come back here after login
$currentUrl = currentUrl();
// rawurlencode converts the string so it's safe to pass as a URL GET parameter
$urlOfLogin = "login.php?sendBackTo=" . rawurlencode($currentUrl) . "&cb=" . microtime(true);
// use a JavaScript redirect; FYI, there's also an http header (Location:) that
// can be used to redirect, but that MUST be sent before any HTML, and this
// function (checkAuth) might be called after some HTML is sent
echo "<script>location.replace('{$urlOfLogin}');</script>";
return "";
} else {
// user is not logged in, but whoever called this function doesn't care
return "";
}
}
}
示例8: saveRedirectURL
public static function saveRedirectURL()
{
$url = $_SERVER["SCRIPT_NAME"];
$query = "";
foreach ($_GET as $key => $value) {
if ($key == "a" && $value == "logout") {
continue;
}
if ($query != "") {
$query .= "&";
}
if (is_array($value)) {
$query .= rawurlencode($key . "[]") . "=";
$query .= implode(rawurlencode($key . "[]") . "=", $value);
} else {
$query .= rawurlencode($key);
if (strlen($value)) {
$query .= "=" . rawurlencode($value);
}
}
}
if ($query != "") {
$url .= "?" . $query;
}
$_SESSION["MyURL"] = $url;
}
示例9: render
/**
* @param string $content
* @return string
*/
public function render($content = NULL)
{
if (NULL === $content) {
$content = $this->renderChildren();
}
return rawurlencode($content);
}
示例10: plugin_redirect_iframe_convert
function plugin_redirect_iframe_convert()
{
global $vars, $script;
$qm = get_qm();
$page = isset($vars['page']) ? $vars['page'] : '';
$args = func_get_args();
$url = strip_autolink(array_pop($args));
if ($url == '') {
$url = $script . '?' . rawurlencode($page);
} else {
$url = is_url($url) ? $url : $script . '?' . rawurlencode($url);
}
$editable = ss_admin_check();
if ($editable) {
return $qm->replace('plg_redirect_iframe.ntc_admin', $url);
} else {
return <<<EOD
<span id="redirect_iframe_msg"><p style="color:gray"><a href="{$url}" target="new">{$qm->m['plg_redirect_iframe']['link']}</a></p></span>
<script type="text/javascript">
<!--
if(parent != self){
parent.location.href="{$url}";
}
else{
var element = document.getElementById("redirect_iframe_msg");
element.innerHTML = "";
}
//-->
</script>
EOD;
}
}
示例11: zeichne_beitrag
function zeichne_beitrag($param)
{
$Erster = $param['Erster'];
$ForumId = $param['ForumId'];
$BeitragId = $param['BeitragId'];
$Autor = $param['Autor'];
$AutorURL = rawurlencode($Autor);
$StempelLetzter = $param['StempelLetzter'];
$Thema = $param['Thema'];
$Inhalt = $param['Inhalt'];
$Egl = $param['Egl'];
$Atavar = $param['Atavar'];
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
$datum = strftime("%d.%b.%Y", $StempelLetzter);
$zeit = date("H.i:s", $StempelLetzter);
if ($Erster) {
echo " <tr>\n <th class=\"ueber\" align=\"center\" width=\"100%\" colspan=\"2\">{$Thema}</th>\n </tr>\n";
}
echo " <tr>\n <td colspan=\"2\">\n <table class=\"beitrag\">\n <tr>\n <th class=\"ueber\" align=\"left\" colspan=\"2\"><a href=\"mitglieder-profil.php?alias={$AutorURL}\">{$Autor}</a></th>\n <th class=\"ueber\" align=\"right\">{$datum} {$zeit}</th>\n </tr>\n <tr>\n";
if ($Atavar > -1) {
echo " <td class=\"col-dunkel\" valign=\"top\">\n <div class=\"atavar\">\n <img src=\"atavar-ausgeben.php?atavar={$Atavar}\">\n </div>\n </td>\n <td class=\"col-hell\" valign=\"top\" colspan=\"2\" width=\"100%\">{$Inhalt}</td>\n";
} else {
echo " <td class=\"col-hell\" valign=\"top\" colspan=\"3\" width=\"100%\">{$Inhalt}</td>\n";
}
echo " </tr>\n </table>\n </td>\n </tr>\n";
// Die Antwort Zeile
if ($Egl) {
echo " <tr>\n <td><font size=\"-1\"><input type=\"radio\" name=\"eltern\" value=\"{$BeitragId}\"";
if ($Erster) {
echo ' checked';
}
echo ">Antworten auf diesen Beitrag</font></td>\n <td align=\"right\"><font size=\"-1\"><button type=\"submit\" name=\"zid\" value=\"{$BeitragId}\">zitieren</button></font></td>\n </tr>\n";
}
}
示例12: getAdminAccountStatus
/**
* Checks whether a an BE user account named admin with default password exists.
*
* @return \TYPO3\CMS\Reports\Status An object representing whether a default admin account exists
*/
protected function getAdminAccountStatus()
{
$value = $GLOBALS['LANG']->getLL('status_ok');
$message = '';
$severity = \TYPO3\CMS\Reports\Status::OK;
$whereClause = 'username = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$secure = TRUE;
/** @var $saltingObject \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */
$saltingObject = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($row['password']);
if (is_object($saltingObject)) {
if ($saltingObject->checkPassword('password', $row['password'])) {
$secure = FALSE;
}
}
// Check against plain MD5
if ($row['password'] === '5f4dcc3b5aa765d61d8327deb882cf99') {
$secure = FALSE;
}
if (!$secure) {
$value = $GLOBALS['LANG']->getLL('status_insecure');
$severity = \TYPO3\CMS\Reports\Status::ERROR;
$editUserAccountUrl = 'alt_doc.php?returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('system_ReportsTxreportsm1')) . '&edit[be_users][' . $row['uid'] . ']=edit';
$message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.backend_admin'), '<a href="' . htmlspecialchars($editUserAccountUrl) . '">', '</a>');
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
return GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
}
示例13: postSMS
private static function postSMS($http, $data)
{
$post = '';
$row = parse_url($http);
$host = $row['host'];
$port = !empty($row['port']) ? $row['port'] : 80;
$file = $row['path'];
while (list($k, $v) = each($data)) {
$post .= rawurlencode($k) . "=" . rawurlencode($v) . "&";
}
$post = substr($post, 0, -1);
$len = strlen($post);
$fp = @fsockopen($host, $port, $errno, $errstr, 10);
// var_dump($fp);exit;
if (!$fp) {
return "{$errstr} ({$errno})\n";
} else {
$receive = '';
$out = "POST {$file} HTTP/1.0\r\n";
$out .= "Host: {$host}\r\n";
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
$out .= "Connection: Close\r\n";
$out .= "Content-Length: {$len}\r\n\r\n";
$out .= $post;
fwrite($fp, $out);
while (!feof($fp)) {
$receive .= fgets($fp, 128);
}
fclose($fp);
$receive = explode("\r\n\r\n", $receive);
unset($receive[0]);
// var_dump($receive);exit;
return implode("", $receive);
}
}
示例14: call
private function call()
{
$curl = array(CURLOPT_POST => 0, CURLOPT_HEADER => 0, CURLOPT_URL => 'http://www.marketinsg.com/index.php?route=information/news/system&url=' . rawurlencode(HTTP_CATALOG), CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1', CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0);
$ch = curl_init();
curl_setopt_array($ch, $curl);
if (!($result = curl_exec($ch))) {
curl_close($ch);
exit;
}
curl_close($ch);
$encoding = mb_detect_encoding($result);
if ($encoding == 'UTF-8') {
$result = preg_replace('/[^(\\x20-\\x7F)]*/', '', $result);
}
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "marketinsg_news WHERE text ='" . $this->db->escape($result) . "'");
if (!$query->num_rows) {
$this->db->query("DELETE FROM " . DB_PREFIX . "marketinsg_news");
$this->db->query("INSERT INTO " . DB_PREFIX . "marketinsg_news SET text ='" . $this->db->escape($result) . "', date_added = NOW()");
}
$disabled = '[{"title":"<strong>You have been disabled from MarketInSG.com news system<\\/strong>"}]';
if (addslashes($result) == addslashes($disabled)) {
$this->db->query("INSERT INTO " . DB_PREFIX . "marketinsg_news_log SET date_checked = NOW(), status = 0");
} else {
$this->db->query("INSERT INTO " . DB_PREFIX . "marketinsg_news_log SET date_checked = NOW(), status = 1");
}
}
示例15: getContentHtml
public static function getContentHtml($title, $leadOnly)
{
$url = 'http://reading-web-research.wmflabs.org/api/slim/';
if ($leadOnly) {
$url .= 'lead/';
}
$url .= rawurlencode($title);
set_error_handler(function () {
throw new Exception('Error at endpoint.');
}, E_WARNING);
$resp = file_get_contents($url, false);
restore_error_handler();
$json = json_decode($resp);
$sections = $json->{'sections'};
if ($leadOnly) {
$content = $sections[0]->{'content'};
$continue = Html::element('a', array('id' => 'loot-fold', 'style' => 'clear:both; display: block;', 'href' => '?full=1#continue-from'), 'Continue reading...');
$content .= $continue;
} else {
$content = '';
foreach ($sections as $key => $section) {
if ($key > 0) {
$content .= '<h2>' . $section->{'title'} . '</h2>';
}
$content .= $section->{'content'};
if ($key === 0) {
$content .= '<div id="continue-from"></div>';
}
}
}
return $content;
}