本文整理汇总了PHP中urlencode函数的典型用法代码示例。如果您正苦于以下问题:PHP urlencode函数的具体用法?PHP urlencode怎么用?PHP urlencode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了urlencode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __toString
/**
* Returns the cookie as a string.
*
* @return string The cookie
*/
public function __toString()
{
$str = urlencode($this->getName()) . '=';
if ('' === (string) $this->getValue()) {
$str .= 'deleted; expires=' . gmdate('D, d-M-Y H:i:s T', time() - 31536001);
} else {
$str .= urlencode($this->getValue());
if ($this->getExpiresTime() !== 0) {
$str .= '; expires=' . gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime());
}
}
if ($this->path) {
$str .= '; path=' . $this->path;
}
if ($this->getDomain()) {
$str .= '; domain=' . $this->getDomain();
}
if (true === $this->isSecure()) {
$str .= '; secure';
}
if (true === $this->isHttpOnly()) {
$str .= '; httponly';
}
return $str;
}
开发者ID:sonfordson,项目名称:Laravel-Fundamentals,代码行数:30,代码来源:Cookie.php
示例2: educator_theme_fonts_url
/**
* Get fonts URL.
*
* @return string
*/
function educator_theme_fonts_url()
{
$fonts = array();
$fonts[] = get_theme_mod('headings_font', 'Open Sans');
$fonts[] = get_theme_mod('body_font', 'Open Sans');
$font_families = array();
$available_fonts = apply_filters('ib_theme_get_fonts', array());
foreach ($fonts as $font_name) {
if (isset($font_families[$font_name])) {
continue;
}
if (isset($available_fonts[$font_name])) {
$font = $available_fonts[$font_name];
$font_families[$font_name] = urlencode($font_name);
if (!empty($font['font_styles'])) {
$font_families[$font_name] .= ':' . $font['font_styles'];
}
}
}
if (empty($font_families)) {
return false;
}
$query_args = array(array('family' => implode('|', $font_families)));
$charater_sets = get_theme_mod('charater_sets', 'latin,latin-ext');
if (!empty($charater_sets)) {
$query_args['subset'] = educator_sanitize_character_sets($charater_sets);
}
return add_query_arg($query_args, '//fonts.googleapis.com/css');
}
开发者ID:Bonus3,项目名称:ib-educator,代码行数:34,代码来源:theme-fonts.php
示例3: callFunction
protected function callFunction($class, $function, $params)
{
$paramString = "/";
foreach ($params as $param) {
$paramString .= urlencode($param) . "/";
}
$url = Config::WWWPath . "/server/json.php/v1." . $class . "." . $function . $paramString;
if (TestConf::verbosity > 3) {
echo "\tCalling URL: " . $url . "\n";
}
if (!function_exists('curl_init')) {
die('You must have cUrl installed to run this test.');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, Config::WWWPath . '/server/test');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
if (TestConf::verbosity == 5) {
echo "\t\tResult: " . $this->stripComments($output) . "\n";
}
if (TestConf::verbosity > 5) {
echo "\t\tResult: " . $output . "\n";
}
return $output;
}
开发者ID:spoymenov,项目名称:arisgames,代码行数:29,代码来源:test.php
示例4: getPublicKeyFromServer
function getPublicKeyFromServer($server, $email)
{
/* refactor to
$command = "gpg --keyserver ".escapeshellarg($server)." --search-keys ".escapeshellarg($email)."";
echo "$command\n\n";
//execute the gnupg command
exec($command, $result);
*/
$curl = new curl();
// get Fingerprint
$data = $curl->get("http://" . $server . ":11371/pks/lookup?search=" . urlencode($email) . "&op=index&fingerprint=on&exact=on");
$data = $data['FILE'];
preg_match_all("/<pre>([\\s\\S]*?)<\\/pre>/", $data, $matches);
//$pub = $matches[1][1];
preg_match_all("/<a href=\"(.*?)\">(\\w*)<\\/a>/", $matches[1][1], $matches);
$url = $matches[1][0];
$keyID = $matches[2][0];
// get Public Key
$data = $curl->get("http://" . $server . ":11371" . $url);
$data = $data['FILE'];
preg_match_all("/<pre>([\\s\\S]*?)<\\/pre>/", $data, $matches);
$pub_key = trim($matches[1][0]);
return array("keyID" => $keyID, "public_key" => $pub_key);
}
开发者ID:baki250,项目名称:angular-io-app,代码行数:25,代码来源:class.pgp.php
示例5: uamloginurl
function uamloginurl($username, $response)
{
global $lanIP;
$username = urlencode($username);
$response = urlencode($response);
return "http://{$lanIP}:3990/login?username={$username}&response={$response}";
}
开发者ID:KuberKode,项目名称:grase-www-portal,代码行数:7,代码来源:automacusers.php
示例6: actionToken
public function actionToken($state)
{
// only poeple on the list should be generating new tokens
if (!$this->context->token->checkAccess($_SERVER['REMOTE_ADDR'])) {
echo "Oh sorry man, this is a private party!";
mail($this->context->token->getEmail(), 'Notice', 'The token is maybe invalid!');
$this->terminate();
}
// facebook example code...
$stoken = $this->session->getSection('token');
if (!isset($_GET['code'])) {
$stoken->state = md5(uniqid(rand(), TRUE));
//CSRF protection
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $this->context->token->getAppId() . "&redirect_uri=" . urlencode($this->link('//Crawler:token')) . "&scope=" . $this->context->token->getAppPermissions() . "&state=" . $stoken->state;
echo "<script> top.location.href='" . $dialog_url . "'</script>";
$this->terminate();
}
if (isset($stoken->state) && $stoken->state === $_GET['state']) {
$token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $this->context->token->getAppId() . "&redirect_uri=" . urlencode($this->link('//Crawler:token')) . "&client_secret=" . $this->context->token->getAppSecret() . "&code=" . $_GET['code'];
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$date = new DateTime();
$date->add(new DateInterval('PT' . $params["expires"] . 'S'));
$this->context->token->saveToken($params['access_token'], $date);
echo "Thanks for your token :)";
} else {
echo "The state does not match. You may be a victim of CSRF.";
}
$this->terminate();
}
开发者ID:ISCCTU,项目名称:fitak,代码行数:31,代码来源:CrawlerPresenter.php
示例7: advanced_pagination
/**
* Advanced pagination. Differenced between simple and advanced paginations is that
* advanced pagination uses template so its output can be changed in a great number of ways.
*
* All variables are just passed to the template, nothing is done inside the function!
*
* @access public
* @param DataPagination $pagination Pagination object
* @param string $url_base Base URL in witch we will insert current page number
* @param string $template Template that will be used. It can be absolute path to existing file
* or template name that used with get_template_path will return real template path
* @param string $page_placeholder Short string inside of $url_base that will be replaced with
* current page numer
* @return null
*/
function advanced_pagination(DataPagination $pagination, $url_base, $template = 'advanced_pagination', $page_placeholder = '#PAGE#')
{
tpl_assign(array('advanced_pagination_object' => $pagination, 'advanced_pagination_url_base' => $url_base, 'advanced_pagination_page_placeholder' => urlencode($page_placeholder)));
// tpl_assign
$template_path = is_file($template) ? $template : get_template_path($template);
return tpl_fetch($template_path);
}
开发者ID:469306621,项目名称:Languages,代码行数:22,代码来源:pagination.php
示例8: startTestsInSandcastle
function startTestsInSandcastle($workflow)
{
// extract information we need from workflow or CLI
$diffID = $workflow->getDiffId();
$username = exec("whoami");
if ($diffID == null || $username == null) {
// there is no diff and we can't extract username
// we cannot schedule sandcasstle job
return;
}
// list of tests we want to run in sandcastle
$tests = array("unit", "unit_481", "clang_unit", "tsan", "asan", "lite");
// construct a job definition for each test and add it to the master plan
foreach ($tests as $test) {
$arg[] = array("name" => "RocksDB diff " . $diffID . " test " . $test, "steps" => $this->getSteps($diffID, $username, $test));
}
// we cannot submit the parallel execution master plan to sandcastle
// we need supply the job plan as a determinator
// so we construct a small job that will spit out the master job plan
// which sandcastle will parse and execute
$arg_encoded = base64_encode(json_encode($arg));
$command = array("name" => "Run diff " . $diffID . "for user " . $username, "steps" => array());
$command["steps"][] = array("name" => "Generate determinator", "shell" => "echo " . $arg_encoded . " | base64 --decode", "determinator" => true, "user" => "root");
// submit to sandcastle
$url = 'https://interngraph.intern.facebook.com/sandcastle/generate?' . 'command=SandcastleUniversalCommand' . '&vcs=rocksdb-git&revision=origin%2Fmaster&type=lego' . '&user=krad&alias=rocksdb-precommit' . '&command-args=' . urlencode(json_encode($command));
$cmd = 'https_proxy= HTTPS_PROXY= curl -s -k -F app=659387027470559 ' . '-F token=AeO_3f2Ya3TujjnxGD4 "' . $url . '"';
$output = shell_exec($cmd);
// extract sandcastle URL from the response
preg_match('/url": "(.+)"/', $output, $sandcastle_url);
echo "\nSandcastle URL: " . $sandcastle_url[1] . "\n";
// Ask phabricator to display it on the diff UI
$this->postURL($diffID, $sandcastle_url[1]);
}
开发者ID:xxxx001,项目名称:rocksdb,代码行数:33,代码来源:FacebookArcanistConfiguration.php
示例9: do_paging
function do_paging()
{
if ($this->total_users_for_query > $this->users_per_page) {
// have to page the results
$this->paging_text = paginate_links(array('total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'prev_text' => '« Previous Page', 'next_text' => 'Next Page »', 'base' => 'users.php?%_%', 'format' => 'userspage=%#%', 'add_args' => array('usersearch' => urlencode($this->search_term))));
}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:7,代码来源:users.php
示例10: getAll
public function getAll()
{
global $lC_Language, $lC_Vqmod;
$media = $_GET['media'];
$lC_DirectoryListing = new lC_DirectoryListing('includes/modules/product_attributes');
$lC_DirectoryListing->setIncludeDirectories(false);
$lC_DirectoryListing->setStats(true);
$localFiles = $lC_DirectoryListing->getFiles();
$addonFiles = lC_Addons_Admin::getAdminAddonsProductAttributesFiles();
$files = array_merge((array) $localFiles, (array) $addonFiles);
$cnt = 0;
$result = array('aaData' => array());
$installed_modules = array();
foreach ($files as $file) {
include $lC_Vqmod->modCheck($file['path']);
$class = substr($file['name'], 0, strrpos($file['name'], '.'));
if (class_exists('lC_ProductAttributes_' . $class)) {
$moduleClass = 'lC_ProductAttributes_' . $class;
$mod = new $moduleClass();
$lC_Language->loadIniFile('modules/product_attributes/' . $class . '.php');
$title = '<td>' . $lC_Language->get('product_attributes_' . $mod->getCode() . '_title') . '</td>';
$action = '<td class="align-right vertical-center"><span class="button-group compact">';
if ($mod->isInstalled()) {
$action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? '#' : 'javascript://" onclick="uninstallModule(\'' . $mod->getCode() . '\', \'' . urlencode($mod->getTitle()) . '\')') . '" class="button icon-minus-round icon-red' . ((int) ($_SESSION['admin']['access']['modules'] < 4) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('icon_uninstall')) . '</a>';
} else {
$action .= '<a href="' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? '#' : 'javascript://" onclick="installModule(\'' . $mod->getCode() . '\', \'' . urlencode($lC_Language->get('product_attributes_' . $mod->getCode() . '_title')) . '\')') . '" class="button icon-plus-round icon-green' . ((int) ($_SESSION['admin']['access']['modules'] < 3) ? ' disabled' : NULL) . '">' . ($media === 'mobile-portrait' || $media === 'mobile-landscape' ? NULL : $lC_Language->get('button_install')) . '</a>';
}
$action .= '</span></td>';
$result['aaData'][] = array("{$title}", "{$action}");
$cnt++;
}
}
$result['total'] = $cnt;
return $result;
}
开发者ID:rajeshb001,项目名称:itpl_loaded7,代码行数:35,代码来源:product_attributes.php
示例11: sendResetPasswordEmail
public function sendResetPasswordEmail($emailOrUserId)
{
$user = new User();
$user->Load("email = ?", array($emailOrUserId));
if (empty($user->id)) {
$user = new User();
$user->Load("username = ?", array($emailOrUserId));
if (empty($user->id)) {
return false;
}
}
$params = array();
//$params['user'] = $user->first_name." ".$user->last_name;
$params['url'] = CLIENT_BASE_URL;
$newPassHash = array();
$newPassHash["CLIENT_NAME"] = CLIENT_NAME;
$newPassHash["oldpass"] = $user->password;
$newPassHash["email"] = $user->email;
$newPassHash["time"] = time();
$json = json_encode($newPassHash);
$encJson = AesCtr::encrypt($json, $user->password, 256);
$encJson = urlencode($user->id . "-" . $encJson);
$params['passurl'] = CLIENT_BASE_URL . "service.php?a=rsp&key=" . $encJson;
$emailBody = file_get_contents(APP_BASE_PATH . '/templates/email/passwordReset.html');
$this->sendEmail("[" . APP_NAME . "] Password Change Request", $user->email, $emailBody, $params);
return true;
}
开发者ID:bravokeyl,项目名称:ems,代码行数:27,代码来源:EmailSender.php
示例12: handleRequest
/**
* @uses ModelAsController::getNestedController()
* @param SS_HTTPRequest $request
* @param DataModel $model
* @return SS_HTTPResponse
*/
public function handleRequest(SS_HTTPRequest $request, DataModel $model)
{
$this->setRequest($request);
$this->setDataModel($model);
$this->pushCurrent();
// Create a response just in case init() decides to redirect
$this->response = new SS_HTTPResponse();
$this->init();
// If we had a redirection or something, halt processing.
if ($this->response->isFinished()) {
$this->popCurrent();
return $this->response;
}
// If the database has not yet been created, redirect to the build page.
if (!DB::is_active() || !ClassInfo::hasTable('SiteTree')) {
$this->response->redirect(Director::absoluteBaseURL() . 'dev/build?returnURL=' . (isset($_GET['url']) ? urlencode($_GET['url']) : null));
$this->popCurrent();
return $this->response;
}
try {
$result = $this->getNestedController();
if ($result instanceof RequestHandler) {
$result = $result->handleRequest($this->getRequest(), $model);
} else {
if (!$result instanceof SS_HTTPResponse) {
user_error("ModelAsController::getNestedController() returned bad object type '" . get_class($result) . "'", E_USER_WARNING);
}
}
} catch (SS_HTTPResponse_Exception $responseException) {
$result = $responseException->getResponse();
}
$this->popCurrent();
return $result;
}
开发者ID:kamrandotpk,项目名称:silverstripe-cms,代码行数:40,代码来源:ModelAsController.php
示例13: get_recipe
function get_recipe($recipe)
{
global $doc, $xpath;
$url = 'http://www.marmiton.org/recettes/recherche.aspx?aqt=' . urlencode($recipe);
$pageList = file_get_contents($url);
// get response list and match recipes titles
if (preg_match_all('#m_titre_resultat[^\\<]*<a .*title="(.+)".* href="(.+)"#isU', $pageList, $matchesList)) {
// echo"<xmp>";print_r($matchesList[1]);echo"</xmp>";
// for each recipes titles
// foreach($matchesList[1] as $recipeTitle) {
// }
// take first recipe
$n = 0;
$url = 'http://www.marmiton.org' . $matchesList[2][$n];
$pageRecipe = file_get_contents($url);
// get recipe (minimize/clean before dom load)
if (preg_match('#<div class="m_content_recette_main">.*<div id="recipePrevNext2"></div>\\s*</div>#isU', $pageRecipe, $match)) {
$recipe = $match[0];
$recipe = preg_replace('#<script .*</script>#isU', '', $recipe);
$doc = loadDOC($pageRecipe);
$xpath = new DOMXpath($doc);
$recipeTitle = fetchOne('//h1[@class="m_title"]');
$recipeMain = fetchOne('//div[@class="m_content_recette_main"]');
return '<div class="recipe_root">' . $recipeTitle . $recipeMain . '</div>';
}
}
}
开发者ID:Broutard,项目名称:MagicMirror,代码行数:27,代码来源:recipe.php
示例14: serve
function serve($slimapp,$token){
if ($token==''){
//redirect to gate to get token
$nexturl = $slimapp->global['lms_token_server'] . '?next=' . urlencode($slimapp->global['lms_url']);
if ($nextcommand!='')
$nexturl . '&nextc=' . $nextcommand;
$slimapp->redirect($nexturl,302);
}
$result=array();
$slimapp->token_extractor_instance->setToken($token);
if ($slimapp->token_extractor_instance->isTokenValid()){
foreach($slimapp->token_extractor_instance->get_commands() as $k=>$cmds){
if (!empty($cmds)){
$fname = $cmds['command'];
$args = $cmds['args'];
$result[]=$fname($args);
} else {
$result[]=array('errcode'=>1010, 'msg'=>'invalid command due to time expiration');
}
}
} else {
$result[]=array('errcode'=>1000, 'msg'=>'invalid Token');
}
$slimapp->response->headers->set('Content-Type','application/json');
$slimapp->response->headers->set('Access-Control-Allow-Origin','*');
$slimapp->response->write(json_encode($result));
}
开发者ID:rm77,项目名称:pd1tt_module,代码行数:28,代码来源:start.php
示例15: process
public function process($args)
{
$this->output = "";
if (strlen(trim($args)) > 0) {
try {
$url = "https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&maxResults=3&type=video&q=" . urlencode($args) . "&key=" . $this->apikey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$respuesta = curl_exec($ch);
curl_close($ch);
$resultados = json_decode($respuesta);
if (isset($resultados->error)) {
$this->output = "Ocurrió un problema al realizar la busqueda: " . $resultados->error->errors[0]->reason;
} else {
if (count($resultados->items) > 0) {
$videos = array();
foreach ($resultados->items as $video) {
array_push($videos, "http://www.youtube.com/watch?v=" . $video->id->videoId . " - " . $video->snippet->title);
}
$this->output = join("\n", $videos);
} else {
$this->output = "No se pudieron obtener resultados al realizar la busqueda indicada.";
}
}
} catch (Exception $e) {
$this->output = "Ocurrió un problema al realizar la busqueda: " . $e->getMessage();
}
} else {
$this->output = "Digame que buscar que no soy adivino.";
}
}
开发者ID:jahrmando,项目名称:botijon,代码行数:33,代码来源:youtube.php
示例16: getLocationsOfHashtag
function getLocationsOfHashtag($hashtag)
{
require_once __DIR__ . '/config.php';
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?lang=en&count=15&q=%40' . $hashtag;
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($twitterSettings);
$response = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
$result = json_decode($response, true);
$cities = array();
foreach ($result['statuses'] as $item) {
if (!empty($item['user']['location'])) {
$cities[] = $item['user']['location'];
}
}
$locations = array();
$googleKey = '&key=' . $googleSettings['server_key'];
foreach ($cities as $city) {
$response = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address=" . urlencode($city) . $googleKey);
$result = json_decode($response, true);
foreach ($result['results'] as $item) {
$item['geometry']['location']['city'] = $city;
$locations[] = $item['geometry']['location'];
}
}
return $locations;
}
开发者ID:BjornHansson,项目名称:twitterHashtagMap,代码行数:27,代码来源:index.php
示例17: check_power_key
/**
* 检查签名
* @param String $power_id 资源ID
* @param String $signature 签名
* @return bool
*/
private function check_power_key()
{
$this->load->model('accessModel/Power_model', 'power');
$power = $this->power->get($this->power_id);
if (empty($power)) {
log_message('debug', sprintf("%s---power_id:%s,signature:%s, power_id is not exists", $this->session_id, $this->power_id, $this->signature));
return FALSE;
}
//组织签名数据
$post = $this->input->post();
unset($post['signature']);
if (isset($post['callback'])) {
$post['callback'] = urlencode($post['callback']);
}
if (isset($post['username'])) {
$post['username'] = urlencode($post['username']);
}
//比对签名
$this->load->helper('signature');
$t_signature = get_signature($post, $power['power_key']);
//var_dump($t_signature);
log_message('debug', sprintf("%s--signature:%s,t_signature:%s", $this->session_id, $this->signature, $t_signature));
$cmp_resut = strcmp($this->signature, $t_signature);
if ($cmp_resut == 0) {
return TRUE;
} else {
log_message('ERROR', sprintf("%s--signature:%s,t_signature:%s", $this->session_id, $this->signature, $t_signature));
return FALSE;
}
}
开发者ID:alswl,项目名称:secken-private,代码行数:36,代码来源:Auth.php
示例18: sendSms
/**
* 普通接口发短信
* apikey 为云片分配的apikey
* text 为短信内容
* mobile 为接受短信的手机号
*/
public function sendSms($text, $mobile)
{
$url = "http://yunpian.com/v1/sms/send.json";
$encoded_text = urlencode("{$text}");
$post_string = "apikey={$this->api_key}&text={$encoded_text}&mobile={$mobile}";
return $this->sock_post($url, $post_string);
}
开发者ID:sammychan1981,项目名称:quanpin,代码行数:13,代码来源:Sms.php
示例19: request
function request($info)
{
$httpObj = new http_class();
$nhHttp = new nhhttp($httpObj);
$partnerId = 10;
//Điền partnerID đc cung cấp
$key = 'x@l0-th1nkn3t';
// Điền key của Partner đc cung cấp
//print_r($_REQUEST);
$paymentMethodList = split("\\.", trim($_REQUEST['m']));
//print_r($paymentMethodList);
$paymentMethod = trim($paymentMethodList[0]);
$postValue = array();
$postValue['o'] = "requestTransaction";
$postValue['itemid'] = $info['product_id'];
$postValue['itemdesc'] = urlencode($info['name']);
$postValue['price'] = $info['price'];
$postValue['method'] = 'Mua_ngay';
$postValue['partnerId'] = $partnerId;
$signal = $this->encodeSignal($postValue['itemid'] . $postValue['itemdesc'] . $postValue['price'] . $postValue['method'] . '|' . $key);
$postValue['signal'] = $signal;
$postValue['param'] = "";
$return = $nhHttp->post("http://payment.xalo.vn/api", $postValue);
$result = explode("|", $return[0]);
return $result;
}
开发者ID:vuong93st,项目名称:w-game,代码行数:26,代码来源:payment.class.php
示例20: widget
function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
if (empty($instance['user_id']) || 'invalid' === $instance['user_id']) {
if (current_user_can('edit_theme_options')) {
echo $args['before_widget'];
echo '<p>' . sprintf(__('You need to enter your numeric user ID for the <a href="%1$s">Goodreads Widget</a> to work correctly. <a href="%2$s">Full instructions</a>.', 'jetpack'), esc_url(admin_url('widgets.php')), 'http://support.wordpress.com/widgets/goodreads-widget/#goodreads-user-id') . '</p>';
echo $args['after_widget'];
}
return;
}
if (!array_key_exists($instance['shelf'], $this->shelves)) {
return;
}
$instance['user_id'] = absint($instance['user_id']);
// Set widget ID based on shelf.
$this->goodreads_widget_id = $instance['user_id'] . '_' . $instance['shelf'];
if (empty($title)) {
$title = esc_html__('Goodreads', 'jetpack');
}
echo $args['before_widget'];
echo $args['before_title'] . $title . $args['after_title'];
$goodreads_url = 'https://www.goodreads.com/review/custom_widget/' . urlencode($instance['user_id']) . '.' . urlencode($instance['title']) . ':%20' . urlencode($instance['shelf']) . '?cover_position=&cover_size=small&num_books=5&order=d&shelf=' . urlencode($instance['shelf']) . '&sort=date_added&widget_bg_transparent=&widget_id=' . esc_attr($this->goodreads_widget_id);
echo '<div class="gr_custom_widget" id="gr_custom_widget_' . esc_attr($this->goodreads_widget_id) . '"></div>' . "\n";
echo '<script src="' . esc_url($goodreads_url) . '"></script>' . "\n";
echo $args['after_widget'];
do_action('jetpack_stats_extra', 'widget', 'goodreads');
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:28,代码来源:goodreads.php
注:本文中的urlencode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论