本文整理汇总了PHP中html2txt函数的典型用法代码示例。如果您正苦于以下问题:PHP html2txt函数的具体用法?PHP html2txt怎么用?PHP html2txt使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html2txt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RunModule
function RunModule()
{
if (isset($_GET['adv']) && (!isset($_GET['q']) && !isset(self::$types[$_GET['adv']]))) {
// if we're using advanced search
$_GET['q'] = $_REQUEST['q'] = $_GET['adv'];
$_GET['adv'] = $_REQUEST['adv'] = '';
}
$query = isset($_GET['q']) ? $_GET['q'] : '';
$adv = isset($_GET['adv']) ? $_GET['adv'] : '';
echo '<h1>Search</h1>';
$this->OutputForm();
echo '<p>Search Results for ' . $query . '</p>';
$scores = self::RunSearch($query, $adv);
foreach ($scores as $row) {
$score = $row[0];
$module = $row[1];
$pkVal = $row[2];
$info = $row[3];
$obj = utopia::GetInstance($module);
$data = $obj->LookupRecord($pkVal);
$url = $obj->GetURL($pkVal);
$title = word_trim(html2txt($data[$info[1]]), 10, true);
$desc = word_trim(html2txt($data[$info[2]]), 30, true);
echo '<div class="searchResult"><a href="' . $url . '">' . $title . '</a><div>' . $desc . '</div></div>';
}
}
示例2: fetch_thread_replies
public function fetch_thread_replies($count, $tid)
{
require_once libfile('function/discuzcode');
require_once './source/plugin/singcere_waterfall/singcere_waterfall.func.php';
$list = array();
$query = DB::query("SELECT * FROM %t WHERE first != 1 AND tid = %d AND invisible >= 0 ORDER BY dateline DESC LIMIT 0, %d", array('forum_post', $tid, $count));
while (($result = DB::fetch($query)) != false) {
preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $result['message'], $matchaids);
$attachs = parseattach($result['tid'], $result['pid'], $matchaids, $result['message'], $skipaids);
$k = $result['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/ ", "\$attachs[\\1]", $result['message']);
eval("\$k=\"{$k}\";");
$k = discuzcode($k, FALSE, FALSE);
$result['message'] = $k;
$result['message'] = html2txt($result['message']);
$list[] = $result;
}
return $list;
}
示例3: find
public function find($page = 1)
{
$limit = 10;
$vdata = array('status' => 0, 'msg' => '未输入关键词!');
if ($str = $this->input->get('w')) {
// 元个数大于5
if (mstrlen($str) > 5) {
$str = get_str_tags(html2txt($str));
}
if ($data = $this->model->find_list($str, $limit, $limit * ($page - 1))) {
$vdata = $data;
$vdata['status'] = 1;
$vdata['msg'] = "获取数据共" . $vdata['count'] . "条";
//分页
$this->load->library('pagination');
$this->pagination->initialize(page_config($limit, $vdata['count'], site_url('tags/find/')));
$vdata['pages'] = $this->pagination->create_links();
}
}
$this->output->set_content_type('application/json')->set_output(json_encode($vdata));
}
示例4: search_output
function search_output()
{
global $db, $opt;
global $distance_unit, $startat, $count, $sql, $sqlLimit;
$encoding = 'UTF-8';
$xmlLine = "\t<cache>\n\t\t<name><![CDATA[{cachename}]]></name>\n\t\t<owner id=\"{ownerid}\"><![CDATA[{owner}]]></owner>\n\t\t<id>{cacheid}</id>\n\t\t<waypoint>{waypoint}</waypoint>\n\t\t<hidden>{time}</hidden>\n\t\t<status id=\"{statusid}\">{status}</status>\n\t\t<lon value=\"{lonvalue}\">{lon}</lon>\n\t\t<lat value=\"{latvalue}\">{lat}</lat>\n\t\t<distance unit=\"" . $distance_unit . "\">{distance}</distance>\n\t\t<type id=\"{typeid}\">{type}</type>\n\t\t<difficulty>{difficulty}</difficulty>\n\t\t<terrain>{terrain}</terrain>\n\t\t<size id=\"{sizeid}\">{container}</size>\n\t\t<country id=\"{countryid}\">{country}</country>\n\t\t<link><![CDATA[" . $opt['page']['default_absolute_url'] . "viewcache.php?wp={waypoint}]]></link>\n\t\t<desc><![CDATA[{shortdesc}]]></desc>\n\t\t<hints><![CDATA[{hints}]]></hints>\n\t</cache>\n";
// create temporary table
sql_temp_table_slave('searchtmp');
sql_slave('CREATE TEMPORARY TABLE &searchtmp SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS ' . $sql . $sqlLimit);
$resultcount = sql_value_slave('SELECT FOUND_ROWS()', 0);
$rsCount = sql_slave('SELECT COUNT(*) `count` FROM &searchtmp');
$rCount = sql_fetch_array($rsCount);
mysql_free_result($rsCount);
// start output
if (!$db['debug']) {
header("Content-type: application/xml; charset=" . $encoding);
//header("Content-Disposition: attachment; filename=" . $sFilebasename . ".txt");
echo "<?xml version=\"1.0\" encoding=\"" . $encoding . "\"?>\n";
echo "<result>\n";
echo "\t<docinfo>\n";
echo "\t\t<results>" . $rCount['count'] . "</results>\n";
echo "\t\t<startat>" . $startat . "</startat>\n";
echo "\t\t<perpage>" . $count . "</perpage>\n";
echo "\t\t<total>" . $resultcount . "</total>\n";
echo "\t</docinfo>\n";
}
$rs = sql_slave("SELECT &searchtmp.`cache_id` `cacheid`,\n &searchtmp.`longitude` `longitude`,\n &searchtmp.`latitude` `latitude`,\n `caches`.`wp_oc` `waypoint`,\n `caches`.`date_hidden` `date_hidden`,\n `caches`.`name` `name`,\n `caches`.`country` `countrycode`,\n `caches`.`terrain` `terrain`,\n `caches`.`difficulty` `difficulty`,\n `caches`.`desc_languages` `desc_languages`,\n `cache_size`.`name` `size`,\n `cache_size`.`id` `size_id`,\n `cache_type`.`name` `type`,\n `cache_type`.`id` `type_id`,\n `cache_status`.`name` `status`,\n `cache_status`.`id` `status_id`,\n `user`.`username` `username`,\n `user`.`user_id` `user_id`,\n `cache_desc`.`desc` `desc`,\n `cache_desc`.`short_desc` `short_desc`,\n `cache_desc`.`hint` `hint`,\n `cache_desc`.`desc_html` `html`,\n &searchtmp.`distance` `distance`,\n `sys_trans_text`.`text` `country`\n FROM &searchtmp\n INNER JOIN `caches` ON &searchtmp.`cache_id`=`caches`.`cache_id`\n INNER JOIN `user` ON &searchtmp.`user_id`=`user`.`user_id`\n INNER JOIN `cache_desc`\n ON `caches`.`cache_id`=`cache_desc`.`cache_id` \n AND `caches`.`default_desclang`=`cache_desc`.`language`\n INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id`\n INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`\n INNER JOIN `cache_size` ON `caches`.`size`=`cache_size`.`id`\n LEFT JOIN `countries` ON `countries`.`short`=`caches`.`country`\n LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id`\n AND `sys_trans_text`.`lang`='&1'", $opt['template']['locale']);
while ($r = sql_fetch_array($rs)) {
if (strlen($r['desc_languages']) > 2) {
$r = get_locale_desc($r);
}
$thisline = $xmlLine;
$lat = sprintf('%01.5f', $r['latitude']);
$thisline = str_replace('{lat}', help_latToDegreeStr($lat), $thisline);
$thisline = str_replace('{latvalue}', $lat, $thisline);
$lon = sprintf('%01.5f', $r['longitude']);
$thisline = str_replace('{lon}', help_lonToDegreeStr($lon), $thisline);
$thisline = str_replace('{lonvalue}', $lon, $thisline);
$time = date('d.m.Y', strtotime($r['date_hidden']));
$thisline = str_replace('{time}', $time, $thisline);
$thisline = str_replace('{waypoint}', $r['waypoint'], $thisline);
$thisline = str_replace('{cacheid}', $r['cacheid'], $thisline);
$thisline = str_replace('{cachename}', filterevilchars($r['name']), $thisline);
$thisline = str_replace('{country}', text_xmlentities($r['country']), $thisline);
$thisline = str_replace('{countryid}', $r['country'], $thisline);
if ($r['hint'] == '') {
$thisline = str_replace('{hints}', '', $thisline);
} else {
$thisline = str_replace('{hints}', str_rot13_gc(decodeEntities(filterevilchars(strip_tags($r['hint'])))), $thisline);
}
$thisline = str_replace('{shortdesc}', filterevilchars($r['short_desc']), $thisline);
if ($r['html'] == 0) {
$thisline = str_replace('{htmlwarn}', '', $thisline);
$thisline = str_replace('{desc}', filterevilchars(strip_tags($r['desc'])), $thisline);
} else {
$thisline = str_replace('{htmlwarn}', ' (Text converted from HTML)', $thisline);
$thisline = str_replace('{desc}', html2txt(filterevilchars($r['desc'])), $thisline);
}
$thisline = str_replace('{type}', $r['type'], $thisline);
$thisline = str_replace('{typeid}', $r['type_id'], $thisline);
$thisline = str_replace('{container}', $r['size'], $thisline);
$thisline = str_replace('{sizeid}', $r['size_id'], $thisline);
$thisline = str_replace('{status}', $r['status'], $thisline);
$thisline = str_replace('{statusid}', $r['status_id'], $thisline);
$difficulty = sprintf('%01.1f', $r['difficulty'] / 2);
$thisline = str_replace('{difficulty}', $difficulty, $thisline);
$terrain = sprintf('%01.1f', $r['terrain'] / 2);
$thisline = str_replace('{terrain}', $terrain, $thisline);
$thisline = str_replace('{owner}', filterevilchars($r['username']), $thisline);
$thisline = str_replace('{ownerid}', filterevilchars($r['user_id']), $thisline);
$thisline = str_replace('{distance}', text_xmlentities(sprintf("%01.1f", $r['distance'])), $thisline);
$thisline = lf2crlf($thisline);
if (!$db['debug']) {
echo $thisline;
}
}
mysql_free_result($rs);
sql_drop_temp_table_slave('searchtmp');
if (!$db['debug']) {
echo "</result>\n";
}
}
示例5: array
}
$page['page'][$i]['souspage'][$j]['image_url'] = "";
$page['page'][$i]['souspage'][$j]['image_largeur'] = "";
$page['page'][$i]['souspage'][$j]['image_hauteur'] = "";
$page['page'][$i]['souspage'][$j]['vignette_url'] = "";
$page['page'][$i]['souspage'][$j]['vignette_largeur'] = "";
$page['page'][$i]['souspage'][$j]['vignette_hauteur'] = "";
$j++;
}
} else {
$page['page'][$i]['souspage'] = array();
}
/* on recupere les infos de la premiere page pour les balises meta */
if ($i == "0") {
$page['meta_description'] = html2txt($ligne['page_summary']);
$page['meta_keyword'] = html2txt($ligne['page_title'] . " " . $ligne['page_summary']);
$page['meta_date'] = $ligne['page_date_edit'];
}
$i++;
}
}
sql_free_result($res_page);
sql_close($sgbd);
if ($right_user['add_information']) {
$page['link_add'] = convert_url("index.php?r=" . $lang['general']['idurl_information'] . "&v1=form_page");
} else {
$page['link_add'] = "";
}
$_SESSION['menu_information'] = $page['page'];
$page['L_add'] = $lang['information']['add_page'];
$page['L_title'] = $lang['information']['information'];
示例6: PageCodeOutbox
function PageCodeOutbox()
{
global $memberID;
global $dir;
global $site;
global $tmpl;
global $date_format;
$query = "\r\n\t\tSELECT\r\n\t\t\t`Messages`.`ID`,\r\n\t\t\tUNIX_TIMESTAMP( `Date` ) AS `timestamp`,\r\n\t\t\tDATE_FORMAT(`Date`, '{$date_format}') AS `Date`,\r\n\t\t\t`Recipient`,\r\n\t\t\t`Profiles`.`NickName` AS `RecipientNickName`,\r\n\t\t\t`Subject`,\r\n\t\t\t`New`\r\n\t\tFROM `Messages`\r\n\t\tLEFT JOIN `Profiles` ON\r\n\t\t\t`Profiles`.`ID` = `Recipient`\r\n\t\tWHERE `Sender` = {$memberID}\r\n\t\tORDER BY `Date` DESC\r\n\t\t";
$rMsgs = db_res($query);
if (!mysql_num_rows($rMsgs)) {
return '<div class="no_result"><div>' . _t("_No messages in Outbox") . '</div></div>';
}
// --- get template and replace headers ---
$aReplace = array();
$aReplace['mailbox_header_img'] = '<img src="' . getTemplateIcon('outbox.gif') . '" class="mailbox_header_img" />';
//$aReplace['summary'] = _t(
$aReplace['flag'] = _t('_Flag');
$aReplace['from'] = _t('_Recipient');
$aReplace['date'] = _t('_Date');
$aReplace['subject'] = _t('_Subject');
$aReplace['click_to_sort'] = _t('_Click to sort');
$aReplace['actions_l'] = '';
$aReplace['actions'] = '';
$ret = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/mail_box.html");
foreach ($aReplace as $key => $val) {
$ret = str_replace("__{$key}__", $val, $ret);
}
$aMyTmpl = preg_split("/\\{\\/?InsertRows\\}/", $ret);
$tmplRow = $aMyTmpl[1];
$ret = "{$aMyTmpl[0]}{InsertRows /}{$aMyTmpl[2]}";
$InsertRows = '';
$tr_class = 'odd';
while ($aMsg = mysql_fetch_assoc($rMsgs)) {
$sSubject = process_line_output(html2txt($aMsg['Subject']));
$aReplace = array();
$aReplace['tr_class'] = $tr_class;
$aReplace['new_add'] = $aMsg['New'] ? 'new' : '';
$aReplace['ID'] = $aMsg['ID'];
$aReplace['CheckBox'] = '';
$aReplace['Flag'] = '<img class="mailbox_flag_img" src="' . getTemplateIcon($aMsg['New'] ? 'not_readed.gif' : 'readed.gif') . '" title="' . _t($aMsg['New'] ? '_Not Readed' : '_Readed') . '" />';
$aReplace['From'] = "<!--{$aMsg['RecipientNickName']}--> <a href=\"{$site['url']}{$aMsg['RecipientNickName']}\">{$aMsg['RecipientNickName']}</a>";
$aReplace['Date'] = "<!--{$aMsg['timestamp']}--> {$aMsg['Date']}";
$aReplace['Subject'] = "<!--{$sSubject}--> <a href=\"{$site['url']}messages_outbox.php?message={$aMsg['ID']}\">{$sSubject}</a>";
$sInsertRow = $tmplRow;
foreach ($aReplace as $key => $val) {
$sInsertRow = str_replace("{{$key}}", $val, $sInsertRow);
}
$sInsertRows .= $sInsertRow;
$tr_class = $tr_class == 'odd' ? 'even' : 'odd';
}
$ret = str_replace("{InsertRows /}", $sInsertRows, $ret);
return $ret;
}
示例7: sendMail
/**
* Send email function
*
* @param string $sRecipientEmail - Email where email should be send
* @param string $sMailSubject - subject of the message
* @param string $sMailBody - Body of the message
* @param integer $iRecipientID - ID of recipient profile
* @param array $aPlus - Array of additional information
*
*
* @return boolean - trie if message was send
* - false if not
*/
function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $sEmailFlag = 'html', $isDisableAlert = false, $bForceSend = false)
{
global $site;
if (!$sRecipientEmail || preg_match('/\\(2\\)$/', $sRecipientEmail)) {
return false;
}
if ($iRecipientID) {
$aRecipientInfo = getProfileInfo($iRecipientID);
}
// don't send mail to the user if he/she decided to not receive any site's notifications, unless it is critical emails (like email confirmation)
if (!$bForceSend) {
$aRealRecipient = $GLOBALS['MySQL']->getRow("SELECT * FROM `Profiles` WHERE `Email`='" . process_db_input($sRecipientEmail, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "' LIMIT 1");
if ($aRealRecipient && 1 != $aRealRecipient['EmailNotify']) {
return true;
}
}
$sEmailNotify = isset($GLOBALS['site']['email_notify']) ? $GLOBALS['site']['email_notify'] : getParam('site_email_notify');
$sSiteTitle = isset($GLOBALS['site']['title']) ? $GLOBALS['site']['title'] : getParam('site_title');
$sMailHeader = "From: =?UTF-8?B?" . base64_encode($sSiteTitle) . "?= <{$sEmailNotify}>";
$sMailParameters = "-f{$sEmailNotify}";
if ($aPlus || $iRecipientID) {
if (!is_array($aPlus)) {
$aPlus = array();
}
bx_import('BxDolEmailTemplates');
$oEmailTemplates = new BxDolEmailTemplates();
$sMailSubject = $oEmailTemplates->parseContent($sMailSubject, $aPlus, $iRecipientID);
$sMailBody = $oEmailTemplates->parseContent($sMailBody, $aPlus, $iRecipientID);
}
$sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?=';
$sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader;
if (!$isDisableAlert && 'on' == getParam('bx_smtp_on')) {
return BxDolService::call('smtpmailer', 'send', array($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters, 'html' == $sEmailFlag, $aRecipientInfo));
}
if ('html' == $sEmailFlag) {
$sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader;
$iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters);
} else {
$sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader;
$sMailBody = html2txt($sMailBody);
$iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters);
}
if (!$isDisableAlert) {
//--- create system event
bx_import('BxDolAlerts');
$aAlertData = array('email' => $sRecipientEmail, 'subject' => $sMailSubject, 'body' => $sMailBody, 'header' => $sMailHeader, 'params' => $sMailParameters, 'html' => 'html' == $sEmailFlag ? true : false);
$oZ = new BxDolAlerts('profile', 'send_mail', $aRecipientInfo['ID'], '', $aAlertData);
$oZ->alert();
}
return $iSendingResult;
}
示例8: urldecode
<?php
/**
* YoutubeGallery for Joomla!
* @version 4.3.6
* @author Ivan Komlev< <support@joomlaboat.com>
* @link http://www.joomlaboat.com
* @GNU General Public License
**/
// No direct access to this file
//defined('_JEXEC') or die('Restricted access');
//require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
$videofile = urldecode($_GET['videofile']);
$videofile = html2txt($videofile);
//YouTubeGalleryMisc::
$videofile = '../../../' . $videofile;
if (!file_exists($videofile)) {
echo 'File not found.';
die;
}
require_once 'flv4php/FLV.php';
$flv = new FLV($videofile);
echo $flv->getFlvThumb();
function html2txt($document)
{
$search = array('@<script[^>]*?>.*?</script>@si', '@<[\\/\\!]*?[^<>]*?>@si', '@<style[^>]*?>.*?</style>@siU', '@<![\\s\\S]*?--[ \\t\\n\\r]*>@');
$text = preg_replace($search, '', $document);
return $text;
}
示例9: limit_words
function limit_words($string, $word_limit)
{
$words = explode(' ', $string);
$toremove = array('—', '“', '"', ',', '.', '-', '?', '•', ',', '.', ':', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '-', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.', ';', '{', '}', '[', ']', '|', '/', '<', '>', '+', '=');
$words = str_replace($toremove, "", $words);
$words = preg_replace('/[\\r\\n\\t\\s]+/s', ' ', $words);
$words = html2txt($words);
return implode(' ', array_splice($words, 0, $word_limit));
}
示例10: array
$page['value_text'] = "";
$page['value_id'] = "";
$page['value_topic'] = "";
$page['erreur'] = array();
$page['form_action'] = convert_url("index.php?r=" . $lang['general']['idurl_forum'] . "&v1=" . $forum['forum_idurl']);
/* modification ou add */
if (isset($_POST) and !empty($_POST)) {
/* we format datas */
$_POST['title'] = format_txt($_POST['title']);
$_POST['text'] = trim($_POST['text']);
/* verification des infos */
if (!isset($_POST['title']) or $_POST['title'] == "") {
$page['erreur'][$nb_erreur]['message'] = $lang['forum']['E_empty_title'];
$nb_erreur++;
}
if (!isset($_POST['text']) or trim(html2txt($_POST['text'])) == "") {
$page['erreur'][$nb_erreur]['message'] = $lang['forum']['E_empty_message'];
$nb_erreur++;
}
/* we format datas */
if (isset($_SESSION['session_member_id']) and !empty($_SESSION['session_member_id'])) {
$_POST['member'] = $_SESSION['session_member_id'];
} else {
$_POST['member'] = 0;
}
$_POST['forum'] = $forum['forum_id'];
$_POST['ip'] = $_SERVER['REMOTE_ADDR'];
if (!isset($_POST['topic']) or $_POST['topic'] == "") {
$_POST['topic'] = "0";
}
# the field email must not be filled in otherwise it mey be a spam robot
示例11: txtAlfabetico
function txtAlfabetico()
{
$txt = ucfirst(LABEL_Titulo) . ': ' . $_SESSION["CFGTitulo"] . "\r\n";
$txt .= ucfirst(LABEL_Autor) . ': ' . $_SESSION["CFGAutor"] . "\r\n";
$txt .= ucfirst(LABEL_Keywords) . ': ' . $_SESSION["CFGKeywords"] . "\r\n";
$txt .= ucfirst(LABEL_Cobertura) . ': ' . $_SESSION["CFGCobertura"] . "\r\n";
$txt .= LABEL_URI . ': ' . $_SESSION["CFGURL"] . "\r\n";
$txt .= ucfirst(LABEL_Version) . ': ' . $_SESSION["CFGVersion"] . "\r\n";
$txt .= "__________________________________________________________________________\r\n";
//Lista de todos los términos
$sql = SQLlistaTemas();
while ($arrayTema = mysqli_fetch_array($sql[datos])) {
#Mantener vivo el navegador
$time_now = time();
if ($time_start >= $time_now + 10) {
$time_start = $time_now;
header('X-pmaPing: Pong');
}
// Diferenciar entre términos preferidos y términos no preferidos o referencias
if ($arrayTema[t_relacion]) {
//Remisiones de equivalencias y no preferidos
$sqlNoPreferidos = SQLterminosValidosUF($arrayTema[id]);
while ($arrayNoPreferidos = mysqli_fetch_array($sqlNoPreferidos[datos])) {
$acronimo = arrayReplace(array("4", "5", "7", "8"), array(USE_termino, EQ_acronimo, EQP_acronimo, NEQ_acronimo), $arrayNoPreferidos[t_relacion]);
$referencia_mapeo = $arrayNoPreferidos[vocabulario_id] !== '1' ? ' (' . $arrayNoPreferidos[titulo] . ' / ' . $arrayNoPreferidos[idioma] . ')' : '' . "\r\n";
$txt .= "\n" . $arrayTema[tema] . $referencia_mapeo;
$txt .= ' ' . $acronimo . ': ' . $arrayNoPreferidos[tema_pref] . "\r\n";
}
} else {
// Si es preferido: mostar notas y relaciones
$txt .= "\n" . $arrayTema[tema] . "\r\n";
$txt .= LABEL_fecha_creacion . ': ' . $arrayTema[cuando] . "\r\n";
if ($arrayTema[cuando_final] > $arrayTema[cuando]) {
$txt .= LABEL_fecha_modificacion . ': ' . $arrayTema[cuando_final] . "\r\n";
}
//Notas
$sqlNotas = SQLdatosTerminoNotas($arrayTema[id], array("NB", "NH", "NA", "NC"));
while ($arrayNotas = mysqli_fetch_array($sqlNotas[datos])) {
$acronimo = arrayReplace(array("NB", "NH", "NA", "NC"), array(NB_acronimo, NH_acronimo, NA_acronimo, NC_acronimo), $arrayNotas[tipo_nota]);
$txt .= ' ' . $acronimo . ': ' . html2txt($arrayNotas[nota]) . "\r\n";
}
//Relaciones
$sqlRelaciones = SQLverTerminoRelaciones($arrayTema[id]);
$arrayRelacionesVisibles = array("2", "3", "4");
// TG/TE/UP /TR
while ($arrayRelaciones = mysqli_fetch_array($sqlRelaciones[datos])) {
if (in_array($arrayRelaciones[t_relacion], $arrayRelacionesVisibles)) {
$acronimo = arrayReplace($arrayRelacionesVisibles, array(TR_acronimo, TG_acronimo, UP_acronimo), $arrayRelaciones[t_relacion]);
$txt .= ' ' . $acronimo . ': ' . $arrayRelaciones[tema] . "\r\n";
}
}
//Terminos especificos
$SQLTerminosE = SQLverTerminosE($arrayTema[id]);
while ($arrayTE = mysqli_fetch_array($SQLTerminosE[datos])) {
$txt .= ' ' . TE_acronimo . ': ' . $arrayTE[tema] . "\r\n";
}
}
}
$filname = string2url($_SESSION[CFGTitulo] . ' ' . MENU_ListaAbc) . '.txt';
return sendFile("{$txt}", "{$filname}");
}
示例12: preg_replace
$title = preg_replace('/[^(\\x20-\\x7F)]*/', '', trim(strip_tags($matches[0][0])));
} else {
$title = '';
}
// Turns out PHP has a function for extracting meta tags for us, the only
// catch is that it works on files, so we fake a file by creating one using
// base64 encode and string concaternation
$tmp = get_meta_tags("data://{$mime};base64," . base64_encode($content));
if (isset($tmp['description'])) {
$desc = preg_replace('/[^(\\x20-\\x7F)]*/', '', trim($tmp['description']));
} else {
$desc = '';
}
// This is the rest of the content. We try to clean it somewhat using
// the custom function html2text which works 90% of the tiem
$content = preg_replace('/[^(\\x20-\\x7F)]*/', '', trim(strip_tags(html2txt($content))));
// If values arent set lets try to set them here. Start with desc
// using content and then try the title using desc
if ($desc == '' && $content != '') {
$desc = substr($content, 0, 200) . '...';
}
if ($title == '' && $desc != '') {
$title = substr($desc, 0, 50) . '...';
}
$count++;
// If we dont have a title, then we dont have desc or content
// so lets not add it to the index
if ($title != '') {
$toindex[] = array($url, $title, $desc, $rank);
echo 'INDEXING ' . $count . "\r\n";
} else {
示例13: Answers_Info
function Answers_Info($user_data)
{
$arr = $user_data['parameters']['res'];
$res = '<table class="data">' . "\n";
$p = $this->Problems_AllById($user_data['contest_id']);
$tasks = $user_data['parameters']['tasks'];
$opened = false;
$n = count($arr);
$i = 0;
while ($i < $n) {
$m = min(10, $n - $i);
$res .= ' <tr>' . "\n ";
for ($j = 0; $j < $m; $j++) {
$pr = $p[$tasks[$i]['problem_id']];
$res .= '<th><span title="' . htmlspecialchars(html2txt($pr['description'])) . '">' . ($i + 1) . '</span></th>';
$i++;
}
for ($j = $m; $j < 10; $j++) {
$res .= '<td class="void"></td>';
}
$res .= ' </tr>' . "\n";
$i -= $m;
$res .= ' <tr>' . "\n ";
for ($j = 0; $j < $m; $j++) {
$title = '';
$pr = $p[$tasks[$i]['problem_id']];
if (!$arr[$i]) {
$lib = new $pr['settings']['anstype']();
$title = htmlspecialchars('Ответ участника: ' . $lib->GetUserAnswerText($pr, $user_data['parameters']['user_answers'][$i], $i));
$title .= htmlspecialchars(' | Верный ответ: ' . $lib->GetCorrectAnswerText($pr));
}
$res .= '<td' . ($arr[$i] ? ' style="background: #cfc"' : '') . '>' . ($arr[$i] ? '+' : '<span title="' . $title . '">-</span>') . '</td>';
$i++;
}
for ($j = $m; $j < 10; $j++) {
$res .= '<td class="void"></td>';
}
$res .= ' </tr>' . "\n";
}
$res .= '</table>' . "\n";
return $res;
}
示例14: txt4term
function txt4term($tema_id, $params = array())
{
$arrayTema = ARRAYverTerminoBasico($tema_id);
$txt .= "\n" . $arrayTema[tema] . "\r\n";
$label_target_vocabulary = '';
$txt .= $params["includeCreatedDate"] == 1 ? LABEL_fecha_creacion . ': ' . $arrayTema[cuando] . "\r\n" : '';
if ($arrayTema[cuando_final] > $arrayTema[cuando] && $params["includeModDate"] == 1) {
$txt .= LABEL_fecha_modificacion . ': ' . $arrayTema[cuando_final] . "\r\n";
}
//Notas
$sqlNotas = SQLdatosTerminoNotas($arrayTema[tema_id]);
while ($arrayNotas = $sqlNotas->FetchRow()) {
$arrayNotas[label_tipo_nota] = in_array($arrayNotas[ntype_id], array(8, 9, 10, 11, 15)) ? arrayReplace(array(8, 9, 10, 11, 15), array(LABEL_NA, LABEL_NH, LABEL_NB, LABEL_NP, LABEL_NC), $arrayNotas[ntype_id]) : $arrayNotas[ntype_code];
if ($arrayNotas[tipo_nota] !== 'NP' && in_array($arrayNotas[tipo_nota], $params["includeNote"])) {
$txt .= ' ' . $arrayNotas[label_tipo_nota] . ': ' . html2txt($arrayNotas[nota]) . "\r\n";
}
}
//Relaciones
$sqlRelaciones = SQLverTerminoRelaciones($arrayTema[tema_id]);
$arrayRelacionesVisibles = array(2, 3, 4, 5, 6, 7);
// TG/TE/UP/TR
while ($arrayRelaciones = $sqlRelaciones->FetchRow()) {
if (in_array($arrayRelaciones[t_relacion], $arrayRelacionesVisibles)) {
$acronimo = arrayReplace($arrayRelacionesVisibles, array(TR_acronimo, TG_acronimo, UP_acronimo, EQP_acronimo, EQ_acronimo, NEQ_acronimo), $arrayRelaciones[t_relacion]);
if (in_array($arrayRelaciones[t_relacion], array(5, 6, 7))) {
//términos equivalentes .. se concatenan después de los TE/NT
$label_target_vocabulary .= ' ' . $acronimo . ': ' . $arrayRelaciones[tema] . ' (' . $arrayRelaciones[titulo] . ')' . "\r\n";
} else {
$txt .= ' ' . $acronimo . $arrayRelaciones[rr_code] . ': ' . $arrayRelaciones[tema] . "\r\n";
}
}
}
//Terminos especificos
$SQLTerminosE = SQLverTerminosE($arrayTema[tema_id]);
while ($arrayTE = $SQLTerminosE->FetchRow()) {
$txt .= ' ' . TE_acronimo . $arrayTE[rr_code] . ': ' . $arrayTE[tema] . "\r\n";
}
$txt .= $label_target_vocabulary;
//Terminos equivalentes web services
$SQLtargetTerms = SQLtargetTerms($arrayTema[tema_id]);
while ($arrayTT = $SQLtargetTerms->FetchRow()) {
$txt .= ' ' . FixEncoding(ucfirst($arrayTT[tvocab_label])) . ': ' . FixEncoding($arrayTT[tterm_string]) . "\r\n";
}
return $txt;
}
示例15: test_ppt
function test_ppt()
{
global $CONF;
//don't run test if utility not on this machine
if ($this->extractor->supported_formats['.ppt']['supported']) {
$filename = $CONF['path_test'] . 'data/test.ppt';
$content = "\n" . $filename . "\n \nCreated with pptHtml\n\n";
//not happy with this - this is a watermark this version of ppthtml inserts
$r = $this->extractor->extract($filename);
$this->assertEqual($content, html2txt($r));
}
}