本文整理汇总了PHP中decode_entities函数的典型用法代码示例。如果您正苦于以下问题:PHP decode_entities函数的具体用法?PHP decode_entities怎么用?PHP decode_entities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decode_entities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: oembedinline_oembed_resolve_link
/**
* oEmbed filter replacement callback.
*
* Override basic function by setting Drupal system variable
* `oembed_resolve_link_callback` to a new function name with this signature.
*
* @param string $url
* URL to embed.
* @param array $options
* oEmbed request options.
*
* @return string
* Rendered oEmbed response.
*/
function oembedinline_oembed_resolve_link($url, $options = array())
{
// If file_entity module is enabled, treat the URL as an uploaded file.
// Inline is used to defer the rendering of the embedded content until the
// entity is actually viewed. This technique allows content to be cached by
// Drupal's filter system.
$view_mode = 'full';
if (isset($options['view_mode'])) {
$view_mode = $options['view_mode'];
unset($options['view_mode']);
}
$url = decode_entities($url);
$element = array();
$file = oembed_url_to_file($url);
$file->override = $options;
if (isset($file->fid)) {
$macro_params = array();
$macro_params[] = 'entity';
$macro_params[] = 'type=file';
$macro_params[] = 'id=' . $file->fid;
$macro_params[] = 'view_mode=' . $view_mode;
$element = array('#markup' => "\r\n" . '[' . implode('|', $macro_params) . ']' . "\r\n");
}
$return = drupal_render($element);
if (empty($return)) {
$return = $url;
}
return $return;
}
示例2: render
/**
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
*
* Renders the contextual fields.
*
* @param \Drupal\views\ResultRow $values
* The values retrieved from a single row of a view's query result.
*
* @see contextual_preprocess()
* @see contextual_contextual_links_view_alter()
*/
public function render(ResultRow $values)
{
$links = array();
foreach ($this->options['fields'] as $field) {
$rendered_field = $this->view->style_plugin->getField($this->view->row_index, $field);
if (empty($rendered_field)) {
continue;
}
$title = $this->view->field[$field]->last_render_text;
$path = '';
if (!empty($this->view->field[$field]->options['alter']['path'])) {
$path = $this->view->field[$field]->options['alter']['path'];
}
if (!empty($title) && !empty($path)) {
// Make sure that tokens are replaced for this paths as well.
$tokens = $this->getRenderTokens(array());
$path = strip_tags(decode_entities(strtr($path, $tokens)));
$links[$field] = array('href' => $path, 'title' => $title);
if (!empty($this->options['destination'])) {
$links[$field]['query'] = drupal_get_destination();
}
}
}
// Renders a contextual links placeholder.
if (!empty($links)) {
$contextual_links = array('contextual' => array('', array(), array('contextual-views-field-links' => UrlHelper::encodePath(Json::encode($links)))));
$element = array('#type' => 'contextual_links_placeholder', '#id' => _contextual_links_to_id($contextual_links));
return drupal_render($element);
} else {
return '';
}
}
示例3: _membership_entity_token_clean_string
/**
* Apply advanced options to a generated member id string.
*/
function _membership_entity_token_clean_string($string, $settings)
{
// Remove all HTML tags from the string.
$return = strip_tags(decode_entities($string));
// Get rid of words that are on the ignore list
$ignore_words = $settings['ignore_words'];
$ignore_words_regex = preg_replace(array('/^[,\\s]+|[,\\s]+$/', '/[,\\s]+/'), array('', '\\b|\\b'), $ignore_words);
if ($ignore_words_regex) {
$ignore_words_regex = '/\\b' . $ignore_words_regex . '\\b/i';
$words_removed = preg_replace($ignore_words_regex, '', $return);
if (drupal_strlen(trim($words_removed)) > 0) {
$return = $words_removed;
}
}
// Replace whitespace with the separator.
$return = _membership_entity_token_clean_separator($return, $settings['separator']);
// Convert to lower or upper case.
if ($settings['case'] == 'lower') {
$return = drupal_strtolower($return);
} else {
if ($settings['case'] == 'upper') {
$return = drupal_strtoupper($return);
}
}
// Shorten to maxlength.
if (!empty($settings['maxlength'])) {
$return = truncate_utf8($return, $settings['maxlength']);
}
return $return;
}
示例4: burzenski_breadcrumb
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function burzenski_breadcrumb($variables)
{
$breadcrumb = $variables['breadcrumb'];
$breadcrumb[] = l(drupal_get_title(), $_GET["q"]);
if (!empty($breadcrumb)) {
$output = '<ul>';
$first = true;
foreach ($breadcrumb as $key => $value) {
if ($first) {
$output .= '<li>' . $value . '</li>';
$first = false;
} else {
$pos = strpos($value, ">");
$innerText = substr($value, $pos + 1, strlen($value) - $pos - 5);
if (strlen($innerText) > 45) {
$newValue = substr($innerText, 0, 42) . "...";
$value = str_replace($innerText, $newValue, $value);
}
$output .= '<li>></li><li>' . decode_entities($value) . '</li>';
}
}
$output .= '</ul>';
return $output;
}
}
示例5: asta_2015_form_alter
function asta_2015_form_alter(&$form, &$form_state, $form_id)
{
if ($form_id == 'search_block_form') {
// HTML5 placeholder attribute
$form['search_block_form']['#attributes']['placeholder'] = t('Search');
$form['actions']['submit']['#value'] = decode_entities('');
}
}
示例6: calcula
function calcula()
{
if (enString($this->web, '.com/v/')) {
$this->web = 'https://www.youtube.com/watch?v=' . substr($this->web, strposF($this->web, '.com/v/'));
}
$this->web = strtr($this->web, array('//m.' => '//www.'));
//id
parse_str(parse_url($this->web, PHP_URL_QUERY), $vars);
//$id=$vars['v']
dbug_r($vars);
$encontrado = false;
$intentos = 3;
$tube = new youtube();
$links = $tube->parse($this->web_descargada);
dbug_r($links);
$web2 = $this->web;
while (($links === false || count($links) == 0) && $intentos > 0) {
dbug("ERROR: " . $tube->error);
dbug('reintentando en 0.1s');
usleep(100000);
$tube = new youtube();
$links = $tube->parse(CargaWebCurl($web2, '', 0, '', array(), true, true));
dbug_r($links);
--$intentos;
}
$obtenido = array('enlaces' => array());
if ($links) {
//imagen
//https://i1.ytimg.com/vi/8GLNKyfdnQg/0.jpg
$imagen = 'https://i1.ytimg.com/vi/' . $vars['v'] . '/0.jpg';
$titulo = entre1y2($this->web_descargada, '<meta name="title" content="', '"');
$titulo = limpiaTitulo($titulo);
foreach ($links as &$link) {
//'ext','p','axb','2D-3D','audio','url'
$obtenido['enlaces'][] = array('url' => $link['url'] . "&title=" . urlencode(decode_entities($titulo)), 'tipo' => 'http', 'url_txt' => $link['p'] . ' ' . $link['ext'] . ($link['2D-3D'] === '3D' ? ': 3D' : '') . ($link['audio'] ? ' - ' . $link['audio'] : ''));
}
$obtenido['titulo'] = $titulo;
$obtenido['imagen'] = $imagen;
finalCadena($obtenido, false);
} else {
setErrorWebIntera($tube->error);
return;
}
}
示例7: getLinks
/**
* Gets the list of links used by this field.
*
* @return array
* The links which are used by the render function.
*/
protected function getLinks()
{
$links = array();
foreach ($this->options['fields'] as $field) {
if (empty($this->view->field[$field]->last_render_text)) {
continue;
}
$title = $this->view->field[$field]->last_render_text;
$path = '';
if (!empty($this->view->field[$field]->options['alter']['path'])) {
$path = $this->view->field[$field]->options['alter']['path'];
}
// Make sure that tokens are replaced for this paths as well.
$tokens = $this->getRenderTokens(array());
$path = strip_tags(decode_entities(strtr($path, $tokens)));
$links[$field] = array('href' => $path, 'title' => $title);
if (!empty($this->options['destination'])) {
$links[$field]['query'] = drupal_get_destination();
}
}
return $links;
}
示例8: location_manager
function location_manager($telegram, $user_id, $chat_id, $location)
{
$lon = $location["longitude"];
$lat = $location["latitude"];
$response = $telegram->getData();
$response = str_replace(" ", "%20", $response);
$reply = "http://nominatim.openstreetmap.org/reverse?email=piersoft2@gmail.com&format=json&lat=" . $lat . "&lon=" . $lon . "&zoom=18&addressdetails=1";
$json_string = file_get_contents($reply);
$parsed_json = json_decode($json_string);
//var_dump($parsed_json);
$comune = "";
$temp_c1 = $parsed_json->{'display_name'};
if ($parsed_json->{'address'}->{'town'}) {
$temp_c1 .= "\nCittà : " . $parsed_json->{'address'}->{'town'};
$comune .= $parsed_json->{'address'}->{'town'};
} else {
$comune .= $parsed_json->{'address'}->{'city'};
}
if ($parsed_json->{'address'}->{'village'}) {
$comune .= $parsed_json->{'address'}->{'village'};
}
$location = "Sto cercando le località contenti \"" . $comune . "\" tramite le coordinate che hai inviato: " . $lat . "," . $lon;
$content = array('chat_id' => $chat_id, 'text' => $location, 'disable_web_page_preview' => true);
$telegram->sendMessage($content);
$alert = "";
// echo $comune;
$urlgd = "db/luoghi.csv";
$inizio = 0;
$homepage = "";
$csv = array_map('str_getcsv', file($urlgd));
$count = 0;
foreach ($csv as $data => $csv1) {
$count = $count + 1;
}
if ($count == 0 || $count == 1) {
$location = "Nessun luogo trovato";
$content = array('chat_id' => $chat_id, 'text' => $location, 'disable_web_page_preview' => true);
$telegram->sendMessage($content);
}
function decode_entities($text)
{
$text = htmlentities($text, ENT_COMPAT, 'ISO-8859-1', true);
$text = preg_replace('/&#(\\d+);/me', "chr(\\1)", $text);
#decimal notation
$text = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $text);
#hex notation
$text = html_entity_decode($text, ENT_COMPAT, "UTF-8");
#NOTE: UTF-8 does not work!
return $text;
}
$result = 0;
for ($i = $inizio; $i < $count; $i++) {
$filter = strtoupper($csv[$i][3]);
if (strpos(decode_entities($filter), strtoupper($comune)) !== false) {
$result = 1;
$homepage .= "\n";
$homepage .= "Nome: " . decode_entities($csv[$i][0]) . "\n";
$homepage .= "Risorsa: " . decode_entities($csv[$i][1]) . "\n";
if ($csv[$i][4] != NULL) {
$homepage .= "Indirizzo: " . decode_entities($csv[$i][4]);
}
if ($csv[$i][5] != NULL) {
$homepage .= ", " . decode_entities($csv[$i][5]);
}
$homepage .= "\n";
if ($csv[$i][3] != NULL) {
$homepage .= "Comune: " . decode_entities($csv[$i][3]) . "\n";
}
if ($csv[$i][9] != NULL) {
$homepage .= "Web: " . decode_entities($csv[$i][9]) . "\n";
}
if ($csv[$i][10] != NULL) {
$homepage .= "Email: " . decode_entities($csv[$i][10]) . "\n";
}
// if($csv[$i][22] !=NULL) $homepage .="Descrizione: ".substr(decode_entities($csv[$i][22]), 0, 400)."..[....]\n";
if ($csv[$i][11] != NULL) {
$homepage .= "Tel: " . decode_entities($csv[$i][11]) . "\n";
}
if ($csv[$i][14] != NULL) {
$homepage .= "Servizi: " . decode_entities($csv[$i][14]) . "\n";
}
if ($csv[$i][15] != NULL) {
$homepage .= "Attrezzature: " . decode_entities($csv[$i][15]) . "\n";
}
if ($csv[$i][16] != NULL) {
$homepage .= "Foto1: " . decode_entities($csv[$i][16]) . "\n";
}
if ($csv[$i][17] != NULL) {
$homepage .= "(realizzata da: " . decode_entities($csv[$i][17]) . ")\n";
}
if ($csv[$i][18] != NULL) {
$homepage .= "Foto2: " . decode_entities($csv[$i][18]) . "\n";
}
if ($csv[$i][19] != NULL) {
$homepage .= "(realizzata da: " . decode_entities($csv[$i][19]) . ")\n";
}
if ($csv[$i][7] != NULL) {
$homepage .= "Mappa:\n";
$homepage .= "http://www.openstreetmap.org/?mlat=" . $csv[$i][7] . "&mlon=" . $csv[$i][8] . "#map=19/" . $csv[$i][7] . "/" . $csv[$i][8];
}
//.........这里部分代码省略.........
示例9: htmlToText
//.........这里部分代码省略.........
// Ensure blank new-line.
$chunk = '';
break;
// Quotation/list markers, non-fancy headers.
// Quotation/list markers, non-fancy headers.
case 'blockquote':
// Format=flowed indentation cannot be mixed with lists.
$indent[] = count($lists) ? ' "' : '>';
break;
case 'li':
$indent[] = isset($lists[0]) && is_numeric($lists[0]) ? ' ' . $lists[0]++ . ') ' : ' * ';
break;
case 'dd':
$indent[] = ' ';
break;
case 'h3':
$indent[] = '.... ';
break;
case 'h4':
$indent[] = '.. ';
break;
case '/blockquote':
if (count($lists)) {
// Append closing quote for inline quotes (immediately).
$output = rtrim($output, "> \n") . "\"\n";
// Ensure blank new-line.
$chunk = '';
}
// Fall-through.
// Fall-through.
case '/li':
case '/dd':
array_pop($indent);
break;
case '/h3':
case '/h4':
array_pop($indent);
case '/h5':
case '/h6':
// Ensure blank new-line.
$chunk = '';
break;
// Fancy headers.
// Fancy headers.
case 'h1':
$indent[] = '======== ';
$casing = 'drupal_strtoupper';
break;
case 'h2':
$indent[] = '-------- ';
$casing = 'drupal_strtoupper';
break;
case '/h1':
case '/h2':
$casing = NULL;
// Pad the line with dashes.
$output = static::htmlToTextPad($output, $tagname == '/h1' ? '=' : '-', ' ');
array_pop($indent);
// Ensure blank new-line.
$chunk = '';
break;
// Horizontal rulers.
// Horizontal rulers.
case 'hr':
// Insert immediately.
$output .= static::wrapMail('', implode('', $indent)) . "\n";
$output = static::htmlToTextPad($output, '-');
break;
// Paragraphs and definition lists.
// Paragraphs and definition lists.
case '/p':
case '/dl':
// Ensure blank new-line.
$chunk = '';
break;
}
} else {
// Convert inline HTML text to plain text; not removing line-breaks or
// white-space, since that breaks newlines when sanitizing plain-text.
$value = trim(decode_entities($value));
if (drupal_strlen($value)) {
$chunk = $value;
}
}
// See if there is something waiting to be output.
if (isset($chunk)) {
// Apply any necessary case conversion.
if (isset($casing)) {
$chunk = $casing($chunk);
}
$line_endings = Settings::get('mail_line_endings', PHP_EOL);
// Format it and apply the current indentation.
$output .= static::wrapMail($chunk, implode('', $indent)) . $line_endings;
// Remove non-quotation markers from indentation.
$indent = array_map('\\Drupal\\Core\\Mail\\MailFormatHelper::htmlToTextClean', $indent);
}
$tag = !$tag;
}
return $output . $footnotes;
}
示例10: foreach
}
// include custom frontend init scripts based on module definitions
if (count($phpwcms['modules_fe_init'])) {
foreach ($phpwcms['modules_fe_init'] as $value) {
include_once $value;
}
}
// redirect to login form if user is not logged in and has no permission to access level
if (!PERMIT_ACCESS && !_getFeUserLoginStatus()) {
if (!empty($block['feloginurl'])) {
$template_default['login_form_url'] = str_replace('{SITE}', PHPWCMS_URL, $block['feloginurl']);
} elseif (empty($template_default['login_form_url'])) {
$template_default['login_form_url'] = PHPWCMS_URL;
}
// store current URL
$_SESSION['LOGIN_REDIRECT'] = decode_entities(FE_CURRENT_URL);
// redirect to login form
headerRedirect($template_default['login_form_url'], 401);
}
//reads all articles for active cat into array
$content["articles"] = get_actcat_articles_data($content["cat_id"]);
$content["article_list_count"] = count($content["articles"]);
// generating a list of articles inside the current article category
if (!$aktion[4]) {
if ($content['404error']['status'] === false && ($content["article_list_count"] || $content['struct'][$content['cat_id']]['acat_topcount'] == -1)) {
$content['opengraph']['type'] = 'article';
if ($content['struct'][$content['cat_id']]['acat_topcount'] == -1 || $content["article_list_count"] === 1 && empty($template_default['settings']['force_article_list_mode'])) {
// if($temp_counter == 1) {
// if only 1 article for this category available
// then show this article directly
// sets article ID to this only 1 article
示例11: ibtimes_header_node_social_share_buttons
?>
<?php
echo ibtimes_header_node_social_share_buttons();
?>
<div class="sticky_social">
<div class="article-social">
<ul class="share">
<li>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php
print $url;
?>
" class="facebook" target="_blank"></a>
</li>
<li>
<a href="http://twitter.com/intent/tweet?status=<?php
print urlencode(decode_entities($title));
?>
+<?php
print $url;
?>
" class="twitter" target="_blank"></a>
</li>
<li>
<a href="https://www.tumblr.com/share/link?url=<?php
print $url;
?>
" class="tumblr" target="_blank"></a>
</li>
<li class="share-more">
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php
print $url;
示例12: europa_easy_breadcrumb
/**
* Overrides theme('easy_breadcrumb').
*/
function europa_easy_breadcrumb($variables)
{
$breadcrumb = $variables['breadcrumb'];
$segments_quantity = $variables['segments_quantity'];
$separator = $variables['separator'];
$html = '';
// We don't print out "Home" if it's the only breadcrumb component.
if ($segments_quantity > 1) {
$html .= '<ol class="breadcrumb">';
for ($i = 0, $s = $segments_quantity - 1; $i < $segments_quantity; ++$i) {
$it = $breadcrumb[$i];
$content = decode_entities($it['content']);
if (isset($it['url'])) {
$html .= '<li>' . l($content, $it['url'], array('attributes' => array('class' => $it['class']))) . '</li>';
} else {
$class = implode(' ', $it['class']);
$html .= '<li class="active ' . $class . '">' . $content . '</li>';
}
if ($i < $s) {
$html .= '<span class="active breadcrumb-separator"> ' . $separator . ' </span>';
}
}
$html .= '</ol>';
}
return $html;
}
示例13: getArgumentsTokens
/**
* Returns to tokens for arguments.
*
* This function is similar to views_handler_field::getRenderTokens()
* but without fields tokens.
*/
public function getArgumentsTokens()
{
$tokens = array();
if (!empty($this->view->build_info['substitutions'])) {
$tokens = $this->view->build_info['substitutions'];
}
// Add tokens for every argument (contextual filter) and path arg.
$handlers = count($this->view->display_handler->getHandlers('argument'));
for ($count = 1; $count <= $handlers; $count++) {
if (!isset($tokens["%{$count}"])) {
$tokens["%{$count}"] = '';
}
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
// were removed by String::checkPlain().
$tokens["!{$count}"] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
}
return $tokens;
}
示例14: VALUES
$sql .= 'adplace_created, adplace_changed, adplace_status, adplace_title, ';
$sql .= 'adplace_format, adplace_width, adplace_height, adplace_prefix, adplace_suffix';
$sql .= ') VALUES (';
$sql .= "'" . aporeplace($plugin['data']['adplace_created']) . "', ";
$sql .= "'" . aporeplace($plugin['data']['adplace_changed']) . "', ";
$sql .= $plugin['data']['adplace_status'] . ", ";
$sql .= "'" . aporeplace($plugin['data']['adplace_title']) . "', ";
$sql .= $plugin['data']['adplace_format'] . ", ";
$sql .= $plugin['data']['adplace_width'] . ", ";
$sql .= $plugin['data']['adplace_height'] . ", ";
$sql .= "'" . aporeplace($plugin['data']['adplace_prefix']) . "', ";
$sql .= "'" . aporeplace($plugin['data']['adplace_suffix']) . "'";
$sql .= ')';
if (@_dbQuery($sql, 'INSERT')) {
if (isset($_POST['save'])) {
headerRedirect(decode_entities(MODULE_HREF) . '&listadplace=1');
}
} else {
$plugin['error']['update'] = mysql_error();
}
}
}
}
// try to read entry from database
if ($plugin['id'] && !isset($plugin['error'])) {
$sql = 'SELECT * FROM ' . DB_PREPEND . 'phpwcms_ads_place WHERE adplace_id=' . $plugin['id'];
$plugin['data'] = _dbQuery($sql);
$plugin['data'] = $plugin['data'][0];
}
// default values
if (empty($plugin['data'])) {
示例15: decode_entities
<div class="indepth <?php
echo $class_style;
?>
">
<?php
if (!empty($title)) {
?>
<div class="block-title"><?php
echo decode_entities($title);
?>
</div>
<?php
}
?>
<ul class="clearfix">
<?php
foreach ($nodes as $node) {
?>
<li>
<?php
if (!empty($node->image)) {
?>
<div class="image hidden-sm hidden-xs"><?php
echo ibtimes_article_node_link($node, $node->image, array('html' => TRUE));
?>
</div>
<?php
}
?>
<div class="category"><?php
echo l($node->section->name, 'taxonomy/term/' . $node->section->tid);