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


PHP html_entity_decode函数代码示例

本文整理汇总了PHP中html_entity_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP html_entity_decode函数的具体用法?PHP html_entity_decode怎么用?PHP html_entity_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: farmtoyou_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @since Farmtoyou 1.0
     *
     * @global WP_Query   $wp_query   WordPress Query object.
     * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
     */
    function farmtoyou_paging_nav()
    {
        global $wp_query, $wp_rewrite;
        // Don't print empty markup if there's only one page.
        if ($wp_query->max_num_pages < 2) {
            return;
        }
        $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
        $pagenum_link = html_entity_decode(get_pagenum_link());
        $query_args = array();
        $url_parts = explode('?', $pagenum_link);
        if (isset($url_parts[1])) {
            wp_parse_str($url_parts[1], $query_args);
        }
        $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
        $pagenum_link = trailingslashit($pagenum_link) . '%_%';
        $format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
        $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%';
        // Set up paginated links.
        $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('&larr; Previous', 'farmtoyou'), 'next_text' => __('Next &rarr;', 'farmtoyou')));
        if ($links) {
            ?>
	<nav class="navigation paging-navigation" role="navigation">
		<div class="pagination loop-pagination">
			<?php 
            echo $links;
            ?>
		</div><!-- .pagination -->
	</nav><!-- .navigation -->
	<?php 
        }
    }
开发者ID:abcode619,项目名称:wpstuff,代码行数:40,代码来源:template-tags.php

示例2: sendBatchMail

 public function sendBatchMail()
 {
     $json = array();
     $store = $this->model_settings_stores->getStore(isset($this->request->post['store_id']) ? (int) $this->request->post['store_id'] : 0);
     $page = 1;
     if (isset($this->request->get['page'])) {
         $page = (int) $this->request->get['page'];
     }
     $this->request->post['start'] = ($page - 1) * 10;
     $this->request->post['limit'] = 10;
     $emails = $this->getData();
     if (count($emails)) {
         $json['next'] = str_replace('&amp;', '&', $this->url->link('app/newsletterbasic/sendbatchmail', 'token=' . $this->session->data['token'] . '&page=' . ($page + 1), 'SSL'));
         $json['success'] = Sumo\Language::getVar('APP_NEWSLETTERBASIC_BATCH_EMAILS_SENT', $page);
         $mail = $this->request->post['mail'];
         foreach ($emails as $data) {
             $language = $this->config->get('language_id');
             if (isset($data['language_id']) && !empty($data['language_id'])) {
                 $language = (int) $data['language_id'];
             }
             $data['name'] = $store['name'];
             $data['url'] = 'http://' . rtrim($store['base_http'], '/') . '/';
             $this->sendMail($data, $mail[$language]['subject'], html_entity_decode($mail[$language]['message']) . '<!-- Email send with SumoStore, leading E-commerce software -->');
         }
     } else {
         $json['next'] = '';
         $json['success'] = Sumo\Language::getVar('APP_NEWSLETTERBASIC_ALL_EMAILS_SENT');
     }
     $json['debug'] = $this->request->post;
     $json['debug_get'] = $this->request->get;
     $this->response->setOutput(json_encode($json));
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:32,代码来源:index.php

示例3: display

 public function display()
 {
     //Set the document link
     $this->_document->link = $this->createRoute('format=html&view=posts&blog_blog_id=' . KRequest::get('get.id', 'int'));
     //Get the list of posts
     $posts = KFactory::get($this->getModel())->getList();
     foreach ($posts as $post) {
         // strip html from feed item title
         $title = html_entity_decode($post->title);
         // url link to article
         $link = $this->createRoute('format=html&view=post&slug=' . $post->slug);
         // generate the description as a hcard
         $description = $post->text;
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = date('r', strtotime($post->created_on));
         $item->category = '';
         // loads item info into rss array
         $doc =& JFactory::getDocument();
         $doc->addItem($item);
     }
     return $this;
 }
开发者ID:raeldc,项目名称:com_blog,代码行数:26,代码来源:feed.php

示例4: index

 protected function index()
 {
     $this->load_language('common/footer');
     $this->data['google_analytics'] = html_entity_decode($this->config->get('config_google_analytics'), ENT_QUOTES, 'UTF-8');
     $this->load->model('catalog/information');
     $this->data['informations'] = array();
     foreach ($this->model_catalog_information->getInformations() as $result) {
         $this->data['informations'][] = array('title' => $result['title'], 'href' => $this->url->link('information/information', 'information_id=' . $result['information_id']));
     }
     $this->data['contact'] = $this->url->link('information/contact');
     $this->data['return'] = $this->url->link('account/return/insert', '', 'SSL');
     $this->data['sitemap'] = $this->url->link('information/sitemap');
     $this->data['manufacturer'] = $this->url->link('product/manufacturer', '', 'SSL');
     $this->data['voucher'] = $this->url->link('checkout/voucher', '', 'SSL');
     $this->data['affiliate'] = $this->url->link('affiliate/account', '', 'SSL');
     $this->data['special'] = $this->url->link('product/special');
     $this->data['account'] = $this->url->link('account/account', '', 'SSL');
     $this->data['order'] = $this->url->link('account/order', '', 'SSL');
     $this->data['wishlist'] = $this->url->link('account/wishlist', '', 'SSL');
     $this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');
     $this->data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/footer.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/common/footer.tpl';
     } else {
         $this->template = 'default/template/common/footer.tpl';
     }
     $this->render();
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:28,代码来源:footer.php

示例5: smtp

 /**
  * Constructor function. Arguments:
  * $params - An assoc array of parameters:
  *
  *   host    - The hostname of the smtp server		Default: localhost
  *   port    - The port the smtp server runs on		Default: 25
  *   helo    - What to send as the HELO command		Default: localhost
  *             (typically the hostname of the
  *             machine this script runs on)
  *   auth    - Whether to use basic authentication	Default: FALSE
  *   user    - Username for authentication			Default: <blank>
  *   pass    - Password for authentication			Default: <blank>
  *   timeout - The timeout in seconds for the call	Default: 5
  *             to fsockopen()
  */
 function smtp($params = array())
 {
     if (!defined('CRLF')) {
         define('CRLF', "\r\n", TRUE);
     }
     $this->authenticated = FALSE;
     $this->timeout = 5;
     $this->status = SMTP_STATUS_NOT_CONNECTED;
     if (!empty($GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'])) {
         $helo = $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'];
     } elseif (!empty($GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'])) {
         $helo = $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'];
     } else {
         $helo = 'localhost';
     }
     $this->host = $_SESSION['SMTPSettings']['host'];
     $this->port = $_SESSION['SMTPSettings']['port'];
     $this->helo = $_SESSION['SMTPSettings']['heloaddress'];
     $this->auth = $_SESSION['SMTPSettings']['auth'];
     $this->user = html_entity_decode($_SESSION['SMTPSettings']['username']);
     $this->pass = html_entity_decode($_SESSION['SMTPSettings']['password']);
     $this->errors = array();
     foreach ($params as $key => $value) {
         $this->{$key} = $value;
     }
 }
开发者ID:rrsc,项目名称:KwaMoja,代码行数:41,代码来源:smtp.php

示例6: swp_buffer_button_html

function swp_buffer_button_html($array)
{
    // If we've already generated this button, just use our existing html
    if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['buffer'])) {
        $array['resource']['buffer'] = $_GLOBALS['sw']['buttons'][$array['postID']]['buffer'];
        // If not, let's check if Buffer is activated and create the button HTML
    } elseif (isset($array['options']['newOrderOfIcons']['buffer']) && !isset($array['buttons']) || isset($array['buttons']) && isset($array['buttons']['buffer'])) {
        // Collect the Title
        $title = get_post_meta($array['postID'], 'nc_ogTitle', true);
        if (!$title) {
            $title = get_the_title();
        }
        $array['totes'] += $array['shares']['buffer'];
        ++$array['count'];
        $array['resource']['buffer'] = '<div class="nc_tweetContainer swp_buffer" data-id="' . $array['count'] . '" data-network="buffer">';
        $link = urlencode(urldecode(swp_process_url($array['url'], 'buffer', $array['postID'])));
        $array['resource']['buffer'] .= '<a target="_blank" href="http://bufferapp.com/add?url=' . $link . '&text=' . urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8')) . '" data-link="http://bufferapp.com/add?url=' . $link . '&text=' . urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8')) . '" class="nc_tweet buffer_link">';
        if ($array['options']['totesEach'] && $array['shares']['totes'] >= $array['options']['minTotes'] && $array['shares']['buffer'] > 0) {
            $array['resource']['buffer'] .= '<span class="iconFiller">';
            $array['resource']['buffer'] .= '<span class="spaceManWilly">';
            $array['resource']['buffer'] .= '<i class="sw sw-buffer"></i>';
            $array['resource']['buffer'] .= '<span class="swp_share"> ' . __('Buffer', 'social-warfare') . '</span>';
            $array['resource']['buffer'] .= '</span></span>';
            $array['resource']['buffer'] .= '<span class="swp_count">' . swp_kilomega($array['shares']['buffer']) . '</span>';
        } else {
            $array['resource']['buffer'] .= '<span class="swp_count swp_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-buffer"></i><span class="swp_share"> ' . __('Buffer', 'social-warfare') . '</span></span></span></span>';
        }
        $array['resource']['buffer'] .= '</a>';
        $array['resource']['buffer'] .= '</div>';
        // Store these buttons so that we don't have to generate them for each set
        $_GLOBALS['sw']['buttons'][$array['postID']]['buffer'] = $array['resource']['buffer'];
    }
    return $array;
}
开发者ID:warfare-plugins,项目名称:social-warfare,代码行数:34,代码来源:buffer.php

示例7: createDistantNoticeLang

 public static function createDistantNoticeLang($version_notice_id, $notice_id, $notice_ref, $lang, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     try {
         $conn->beginTransaction();
         //Début de la transaction
         //Appel du webservice
         $result_service = MyFunction::loadResultOfWebServiceByPostJson(MyFunction::getPrefixPath(null) . "serviceweb/createNoticeVersion.json", array('version_notice_id' => $version_notice_id, 'notice_id' => $notice_id, 'notice_ref' => $notice_ref, 'lang' => $lang));
         //Récupération de la nouvelle langue de notice pour traitement
         $array_result = json_decode(html_entity_decode($result_service), true);
         if (count($array_result) == 0) {
             return array("success" => false, "message" => "Error on transaction");
         }
         if (array_key_exists("error", $array_result)) {
             return array("success" => false, "message" => $array_result["error"]);
         }
         if (!$array_result[0]) {
             return array("success" => false, "message" => "Empty result content");
         }
         self::reload($array_result, $conn);
         $conn->commit();
         return Doctrine_Core::getTable("EiVersionNotice")->findOneByVersionNoticeIdAndNoticeIdAndNoticeRefAndLang($version_notice_id, $notice_id, $notice_ref, $lang);
     } catch (Exception $e) {
         $conn->rollback();
         throw $e;
         return false;
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:30,代码来源:EiVersionNotice.class.php

示例8: execute

 /**
  * Here we do the work
  */
 public function execute($comment)
 {
     global $_CONF, $_TABLES, $_USER, $LANG_SX00;
     if (isset($_USER['uid']) && $_USER['uid'] > 1) {
         $uid = $_USER['uid'];
     } else {
         $uid = 1;
     }
     /**
      * Include Blacklist Data
      */
     $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='Personal'", 1);
     $nrows = DB_numRows($result);
     // named entities
     $comment = html_entity_decode($comment);
     // decimal notation
     $comment = preg_replace_callback('/&#(\\d+);/m', array($this, 'callbackDecimal'), $comment);
     // hex notation
     $comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment);
     $ans = 0;
     for ($i = 1; $i <= $nrows; $i++) {
         list($val) = DB_fetchArray($result);
         $val = str_replace('#', '\\#', $val);
         if (preg_match("#{$val}#i", $comment)) {
             $ans = 1;
             // quit on first positive match
             SPAMX_log($LANG_SX00['foundspam'] . $val . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']);
             break;
         }
     }
     return $ans;
 }
开发者ID:spacequad,项目名称:glfusion,代码行数:35,代码来源:BlackList.Examine.class.php

示例9: to_money

 public function to_money($number, $do_encode = false)
 {
     if (!is_numeric($number)) {
         $number = $this->to_number($number);
     }
     if ($number === false) {
         return '';
     }
     $negative = '';
     if (strpos(strval($number), '-') !== false) {
         $negative = '-';
         $number = floatval(substr($number, 1));
     }
     $money = number_format($number, $this->currency['decimals'], $this->currency['decimal_separator'], $this->currency['thousand_separator']);
     if ($money == '0.00') {
         $negative = '';
     }
     $symbol_left = !empty($this->currency['symbol_left']) ? $this->currency['symbol_left'] . $this->currency['symbol_padding'] : '';
     $symbol_right = !empty($this->currency['symbol_right']) ? $this->currency['symbol_padding'] . $this->currency['symbol_right'] : '';
     if ($do_encode) {
         $symbol_left = html_entity_decode($symbol_left);
         $symbol_right = html_entity_decode($symbol_right);
     }
     return $negative . $symbol_left . $money . $symbol_right;
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:25,代码来源:currency.php

示例10: showFields

 public static function showFields($mb)
 {
     $adminTemplatesFolderLocation = dirname(__FILE__) . '/admin_views/';
     Mustache_Autoloader::register();
     $template = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($adminTemplatesFolderLocation), 'partials_loader' => new Mustache_Loader_FilesystemLoader($adminTemplatesFolderLocation)));
     $fields = $mb->fields;
     foreach ($fields as $field) {
         if (empty($field['name']) || empty($field['fieldType']) || empty($field['labelTitle'])) {
             continue;
         }
         $mb->the_field($field['name']);
         if ($field['fieldType'] == 'textarea') {
             wp_editor(html_entity_decode($mb->get_the_value()), $mb->get_the_name(), array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => true, 'dfw' => false, 'tinymce' => false, 'quicktags' => true));
         } else {
             switch ($field['fieldType']) {
                 case 'imageUploader':
                     $fieldHtml = self::getImageUploaderHtml($mb, $template);
                     break;
                 default:
                     $fieldHtml = $template->render('text_field', array('theValue' => $mb->get_the_value(), 'theName' => $mb->get_the_name()));
             }
             echo $template->render('field_container', array('labelText' => $field['labelTitle'], 'fieldHTML' => $fieldHtml));
         }
     }
 }
开发者ID:zakirsajib,项目名称:Chester-WordPress-MVC-Theme-Framework,代码行数:25,代码来源:wp_alchemy_helpers.php

示例11: filter

 /**
  * Return filtered value
  * Removes potential XSS code from the input string.
  *
  * Using an external class by Travis Puderbaugh <kallahar@quickwired.com>
  *
  * @param string $value Unfiltered value
  * @return string The filtered value
  */
 public function filter($value)
 {
     $value = stripslashes($value);
     $value = html_entity_decode($value, ENT_QUOTES);
     $filteredValue = \TYPO3\CMS\Core\Utility\GeneralUtility::removeXSS($value);
     return $filteredValue;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:16,代码来源:RemoveXssFilter.php

示例12: loadConfig

 public function loadConfig()
 {
     $this->installed = html_entity_decode(Configuration::get('DJL_INSTALLED'), ENT_COMPAT, 'UTF-8');
     $this->useSSL = (int) html_entity_decode(Configuration::get('DJL_USE_SSL'), ENT_COMPAT, 'UTF-8');
     $this->serviceURL = html_entity_decode(Configuration::get('DJL_SERVICE_URL'), ENT_COMPAT, 'UTF-8');
     $this->sandboxServiceURL = html_entity_decode(Configuration::get('DJL_SANDBOX_SERVICE_URL'), ENT_COMPAT, 'UTF-8');
     $this->mode = html_entity_decode(Configuration::get('DJL_MODE'), ENT_COMPAT, 'UTF-8');
     $this->login = html_entity_decode(Configuration::get('DJL_LOGIN'), ENT_COMPAT, 'UTF-8');
     $this->password = html_entity_decode(Configuration::get('DJL_PASSWORD'), ENT_COMPAT, 'UTF-8');
     $this->trigerringStatuses = html_entity_decode(Configuration::get('DJL_TRIGERRING_STATUSES'), ENT_COMPAT, 'UTF-8');
     $this->shippingPrefix = html_entity_decode(Configuration::get('DJL_SHIPPING_PREFIX'), ENT_COMPAT, 'UTF-8');
     $this->country = html_entity_decode(Configuration::get('DJL_COUNTRY'), ENT_COMPAT, 'UTF-8');
     if (strlen($this->country) == 0) {
         $this->country = 'fr';
     }
     $this->visibility_status = html_entity_decode(Configuration::get('DJL_VISIBILITY_STATUS'), ENT_COMPAT, 'UTF-8');
     $this->visible_users_list = html_entity_decode(Configuration::get('DJL_VISIBLE_USERS_LIST'), ENT_COMPAT, 'UTF-8');
     $this->internal_version = Configuration::get('DJL_VERSION');
     // Backward compatibility
     $activeVal = html_entity_decode(Configuration::get('DJL_ACTIVE'), ENT_COMPAT, 'UTF-8');
     if ($activeVal != "") {
         $this->active = (int) $activeVal;
         $this->visibility_status = $this->active == 0 ? "invisible" : "visible";
     }
     if ($this->visibility_status == "") {
         $this->visibility_status = "invisible";
     }
 }
开发者ID:greench,项目名称:prestashop,代码行数:28,代码来源:dejalaconfig.php

示例13: generateJSON

function generateJSON($auth_key, $guid, $year, $filename)
{
    // Get json from API
    $url = "http://api.quito.junar.com/datastreams/invoke/" . $guid . "?auth_key=" . $auth_key . "&output=json_array";
    $str = file_get_contents($url);
    $json = json_decode($str, true);
    // Array of Zonales id
    $zonales_id = array(1 => "Calderón", 2 => "Eloy Alfaro", 3 => "Eugenio Espejo", 4 => "La Delicia", 5 => "Los Chillos", 6 => "Manuela Saenz", 7 => "Quitumbe", 8 => "Tumbaco", 12 => "Sur", 13 => "Norte", 16 => "Centro");
    $datos = array();
    // Reading JSON and verify
    foreach ($json['result'] as $data) {
        $id_zonal = 0;
        $zonal = reset($zonales_id);
        // Checks if json contains a valid zonal and returns id
        while ($zonal = current($zonales_id)) {
            if (strpos($zonal, $data[1]) !== false) {
                $id_zonal = key($zonales_id);
                break;
            }
            next($zonales_id);
        }
        // Assings data according to id
        if ($id_zonal > 0) {
            if ($id_zonal > 10) {
                $id_zonal = $id_zonal - 10;
            }
            $datos[] = array("id" => $id_zonal, "zonal" => html_entity_decode($zonales_id[$id_zonal]), "periodo" => 2014, "dato" => intval($data[14]));
        }
    }
    // Write json
    file_put_contents($filename, json_encode($datos));
}
开发者ID:flandrade,项目名称:quito-crime-map,代码行数:32,代码来源:getdata.php

示例14: setMetadata

 /**
  * Register the article's metadata with the SWORD deposit.
  */
 function setMetadata()
 {
     $this->package->setCustodian($this->journal->getSetting('contactName'));
     $this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8'));
     $this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8'));
     $this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale()));
     // The article can be published or not. Support either.
     if (is_a($this->article, 'PublishedArticle')) {
         $doi = $this->article->getPubId('doi');
         if ($doi !== null) {
             $this->package->setIdentifier($doi);
         }
     }
     foreach ($this->article->getAuthors() as $author) {
         $creator = $author->getFullName(true);
         $affiliation = $author->getAffiliation($this->journal->getPrimaryLocale());
         if (!empty($affiliation)) {
             $creator .= "; {$affiliation}";
         }
         $this->package->addCreator($creator);
     }
     // The article can be published or not. Support either.
     if (is_a($this->article, 'PublishedArticle')) {
         $plugin =& PluginRegistry::loadPlugin('citationFormats', 'bibtex');
         $this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8'));
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:30,代码来源:OJSSwordDeposit.inc.php

示例15: diaspora2bb

function diaspora2bb($s)
{
    $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
    // Remove CR to avoid problems with following code
    $s = str_replace("\r", "", $s);
    $s = str_replace("\n", " \n", $s);
    // The parser cannot handle paragraphs correctly
    $s = str_replace(array("</p>", "<p>", '<p dir="ltr">'), array("<br>", "<br>", "<br>"), $s);
    // Escaping the hash tags
    $s = preg_replace('/\\#([^\\s\\#])/', '&#35;$1', $s);
    $s = Markdown($s);
    $s = preg_replace('/\\@\\{(.+?)\\; (.+?)\\@(.+?)\\}/', '@[url=https://$3/u/$2]$1[/url]', $s);
    $s = str_replace('&#35;', '#', $s);
    $s = html2bbcode($s);
    // protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands
    $s = str_replace('&#x2672;', html_entity_decode('&#x2672;', ENT_QUOTES, 'UTF-8'), $s);
    // Convert everything that looks like a link to a link
    $s = preg_replace("/([^\\]\\=]|^)(https?\\:\\/\\/)([a-zA-Z0-9\\:\\/\\-\\?\\&\\;\\.\\=\\_\\~\\#\\%\$\\!\\+\\,]+)/ism", '$1[url=$2$3]$2$3[/url]', $s);
    //$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
    $s = bb_tag_preg_replace("/\\[url\\=?(.*?)\\]https?:\\/\\/www.youtube.com\\/watch\\?v\\=(.*?)\\[\\/url\\]/ism", '[youtube]$2[/youtube]', 'url', $s);
    $s = bb_tag_preg_replace("/\\[url\\=https?:\\/\\/www.youtube.com\\/watch\\?v\\=(.*?)\\].*?\\[\\/url\\]/ism", '[youtube]$1[/youtube]', 'url', $s);
    $s = bb_tag_preg_replace("/\\[url\\=?(.*?)\\]https?:\\/\\/vimeo.com\\/([0-9]+)(.*?)\\[\\/url\\]/ism", '[vimeo]$2[/vimeo]', 'url', $s);
    $s = bb_tag_preg_replace("/\\[url\\=https?:\\/\\/vimeo.com\\/([0-9]+)\\](.*?)\\[\\/url\\]/ism", '[vimeo]$1[/vimeo]', 'url', $s);
    // remove duplicate adjacent code tags
    $s = preg_replace("/(\\[code\\])+(.*?)(\\[\\/code\\])+/ism", "[code]\$2[/code]", $s);
    // Don't show link to full picture (until it is fixed)
    $s = scale_external_images($s, false);
    return $s;
}
开发者ID:strk,项目名称:friendica,代码行数:29,代码来源:bb2diaspora.php


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