Ejemplo n.º 1
0
function nw_remove_accents($chain){
	/**
    * if XOOPS ML is present, let's sanitize the title with the current language
    */
    $myts = MyTextSanitizer::getInstance();
    if (method_exists($myts, 'formatForML')) {
    	$chain = $myts->formatForML($chain);
    }
    
	/**
    * if xLanguage is present, let's prepare the title with the current language
    */
	$module_handler =& xoops_gethandler('module');
	$xlanguage = $module_handler->getByDirname('xlanguage');
	if ( is_object($xlanguage) && $xlanguage->getVar('isactive') == true ) 
	{ 
		require_once XOOPS_ROOT_PATH.'/modules/xlanguage/include/functions.php';
		$chain = xlanguage_ml($chain); 
	} 	
    
    $chain = rawurlencode($chain);
    $chain = utf8_decode($chain);

    // Transform punctuation
    //                 Tab     Space      !        "        #        %        &        '        (        )        ,        /        :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       .
    $pattern = array("/%09/", "/%20/", "/%21/", "/%22/", "/%23/", "/%25/", "/%26/", "/%27/", "/%28/", "/%29/", "/%2C/", "/%2F/", "/%3A/", "/%3B/", "/%3C/", "/%3D/", "/%3E/", "/%3F/", "/%40/", "/%5B/", "/%5C/", "/%5D/", "/%5E/", "/%7B/", "/%7C/", "/%7D/", "/%7E/", "/\./");
    $rep_pat = array(  "-"  ,   "-"  ,   ""   ,   ""   ,   ""   , "-100" ,   ""   ,   "-"  ,   ""   ,   ""   ,   ""   ,   "-"  ,   ""   ,   ""   ,   ""   ,   "-"  ,   ""   ,   ""   , "-at-" ,   ""   ,   "-"   ,  ""   ,   "-"  ,   ""   ,   "-"  ,   ""   ,   "-"  ,  ""  );
    $chain   = preg_replace($pattern, $rep_pat, $chain);
    
    $chain .= '.html';
    return $chain;
}
Ejemplo n.º 2
0
function xlanguage_encoding($output)
{
    global $xlanguage;
    $output = xlanguage_ml($output);
    // escape XML doc
    if (preg_match("/^\\<\\?[\\s]?xml[\\s]+version=([\"'])[^\\>]+\\1[\\s]+encoding=([\"'])[^\\>]+\\2[\\s]?\\?\\>/i", $output)) {
        return $output;
    }
    $in_charset = $xlanguage["charset_base"];
    $out_charset = $xlanguage["charset"];
    return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset);
}
Ejemplo n.º 3
0
/**
 * @param string $output
 *
 * @return array|mixed|string
 */
function xlanguage_encoding($output)
{
    $xoops = Xoops::getInstance();
    $xlanguage = $xoops->registry()->get('XLANGUAGE');
    $output = xlanguage_ml($output);
    // escape XML doc
    if (preg_match("/^\\<\\?[\\s]?xml[\\s]+version=([\"'])[^\\>]+\\1[\\s]+encoding=([\"'])[^\\>]+\\2[\\s]?\\?\\>/i", $output)) {
        return $output;
    }
    $in_charset = $xlanguage['charset_base'];
    $out_charset = $xlanguage['charset'];
    return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset);
}
Ejemplo n.º 4
0
$module_handler =& xoops_gethandler('module');
$xlanguage = $module_handler->getByDirname('xlanguage');
if ( is_object($xlanguage) && $xlanguage->getVar('isactive') == true ) 
{ $xlang = true; } else { $xlang = false; }  	

$content = '';
$content .= '<b><i><u>'.$myts->undoHtmlSpecialChars($article->title()).'</u></i></b><br /><b>'.$myts->undoHtmlSpecialChars($article->topic_title()).'</b><br />'._POSTEDBY.' : '.$myts->undoHtmlSpecialChars($article->uname()).'<br />'._MA_NW_POSTEDON.' '.formatTimestamp($article->published(),$dateformat).'<br /><br /><br />';
//$content .= $myts->undoHtmlSpecialChars($article->hometext()) . '<br /><br /><br />' . $myts->undoHtmlSpecialChars($article->bodytext());
//$content = str_replace('[pagebreak]','<br />',$content);
$content .= $myts->undoHtmlSpecialChars($article->hometext()) . '<br />' . $myts->undoHtmlSpecialChars($article->bodytext());
$content = str_replace('[pagebreak]','<tcpdf method="AddPage" />',$content);

//DNPROSSI Added - Get correct language and remove tags from text to be sent to PDF
if ( $xlang == true ) { 
   include_once XOOPS_ROOT_PATH.'/modules/xlanguage/include/functions.php';
   $content = xlanguage_ml($content);
}

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$doc_title = $myts->undoHtmlSpecialChars($article->title());
$doc_keywords = 'XOOPS';

//DNPROSSI ADDED gbsn00lp chinese to tcpdf fonts dir
if (_LANGCODE == "cn") { $pdf->SetFont('gbsn00lp', '', 10); } 

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle($doc_title);
$pdf->SetSubject($doc_title);
$pdf->SetKeywords($doc_keywords);
Ejemplo n.º 5
0
function trans($string, $lang = null)
{
    $myts =& MyTextSanitizer::getInstance();
    if (function_exists('easiestml')) {
        global $easiestml_lang;
        $easiestml_lang = isset($_GET['lang']) ? $_GET['lang'] : $easiestml_lang;
        // this is required when linked with a Drupal install
        $original_easiestml_lang = $easiestml_lang;
        $easiestml_lang = $lang ? $lang : $easiestml_lang;
        $string = easiestml($string);
        $easiestml_lang = $original_easiestml_lang;
    } elseif (function_exists('xlanguage_ml')) {
        $string = xlanguage_ml($string);
    } elseif (method_exists($myts, 'formatForML')) {
        $string = $myts->formatForML($string);
    }
    return $string;
}