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


PHP tidy::repairString方法代码示例

本文整理汇总了PHP中tidy::repairString方法的典型用法代码示例。如果您正苦于以下问题:PHP tidy::repairString方法的具体用法?PHP tidy::repairString怎么用?PHP tidy::repairString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tidy的用法示例。


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

示例1: init

 public static function init()
 {
     if (!ob_start(function ($buffer) {
         $tidy = new \tidy();
         return $tidy->repairString($buffer, ['input-xml' => true, 'indent' => true, 'wrap' => 0, 'output-xml' => true]);
     })) {
         throw \ErrorException("ob_start failed", null, null, __FILE__, __LINE__);
     }
 }
开发者ID:roman-rybalko,项目名称:wcs,代码行数:9,代码来源:xml_formatter.php

示例2: tidyHTML

 public static function tidyHTML($html)
 {
     if (extension_loaded(tidy)) {
         $tidy = new \tidy();
         $cleanHTML = $tidy->repairString($html, array('indent' => true, 'indent-spaces' => 2, 'show-body-only' => true, 'merge-divs' => false));
         return $cleanHTML;
     } else {
         return $html;
     }
 }
开发者ID:e4ong1031,项目名称:Ontokiwi,代码行数:10,代码来源:DisplayHelper.php

示例3: after

 /**
  * (non-PHPdoc)
  * @see app/Lib/Browser/Mixin/Browser\Mixin.Iface::after()
  */
 public function after(\stdClass $Object, array $params = [], array $arguments = [])
 {
     if (class_exists('\\tidy')) {
         $Tidy = new \tidy();
         $params['content'] = $Tidy->repairString($params['content'], ['output-xhtml' => true], 'utf8');
         unset($Tidy);
     }
     // возвращаем обработанные данные
     return $params;
 }
开发者ID:pdedkov,项目名称:browser,代码行数:14,代码来源:Tidy.php

示例4: render

 /**
  * Trims content, then trims each line of content
  *
  * @param string $content
  * @return string
  */
 public function render($content = NULL)
 {
     if ($content === NULL) {
         $content = $this->renderChildren();
     }
     if (class_exists('tidy') === FALSE) {
         throw new Exception('TidyViewHelper requires the PHP extension "tidy" which is not installed or not loaded.', 1352059753);
     }
     $tidy = new tidy();
     return $tidy->repairString($content);
 }
开发者ID:nyxos,项目名称:vhs,代码行数:17,代码来源:TidyViewHelper.php

示例5: getXPath

 protected function getXPath($content)
 {
     $document = new DOMDocument();
     $document->strictErrorChecking = false;
     if ($this->options['tidy'] && extension_loaded('tidy')) {
         //Convert and repair as xhtml
         $tidy = new tidy();
         $content = $tidy->repairString($content, $this->options['tidy_config']);
     }
     $document->loadXML($content, LIBXML_NOERROR | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOCDATA);
     $xpath = new DOMXPAth($document);
     $xpath->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml');
     return $xpath;
 }
开发者ID:unl,项目名称:Spider,代码行数:14,代码来源:Parser.php

示例6: setContent

 /**
  * pretizeno o TIDY cisteni
  */
 public function setContent($content = "")
 {
     try {
         if (ini_get("magic_quotes_gpc")) {
             $content = stripslashes($content);
         }
         if (class_exists("tidy")) {
             $tidyConfig = array('indent' => true, 'output-xml' => false, 'output-html' => false, 'output-xhtml' => true, 'show-body-only' => true, 'clean' => true, 'wrap' => 200);
             $tidy = new tidy();
             //var_dump($content);
             $content = $tidy->repairString($content, $tidyConfig, 'UTF8');
             //var_dump($content);die;
         }
         return parent::setContent($content);
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:palmic,项目名称:lbox,代码行数:21,代码来源:class.LBoxMetanodeRichText.php

示例7: filter

 public function filter(LBoxFormControl $control = NULL)
 {
     try {
         $content = $control->getValue();
         if (ini_get("magic_quotes_gpc")) {
             $content = stripslashes($content);
         }
         if (class_exists("tidy")) {
             $tidyConfig = array('indent' => true, 'output-xml' => false, 'output-html' => false, 'output-xhtml' => true, 'show-body-only' => true, 'clean' => true, 'wrap' => 200);
             $tidy = new tidy();
             //var_dump($content);
             $content = $tidy->repairString($content, $tidyConfig, 'UTF8');
             //var_dump($content);die;
         }
         return $content;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:palmic,项目名称:lbox,代码行数:19,代码来源:class.LBoxFormFilterMetarecordRichtext.php

示例8: filter

 public function filter(LBoxFormControl $control = NULL)
 {
     try {
         $value = $control->getValue();
         if (function_exists("mb_convert_encoding") && function_exists("mb_convert_encoding")) {
             if (mb_detect_encoding($value) != "UTF-8") {
                 $value = mb_convert_encoding($value, "UTF-8");
             }
         }
         if (class_exists("tidy")) {
             $tidyConfig = array('indent' => true, 'output-xml' => false, 'output-html' => false, 'output-xhtml' => true, 'show-body-only' => true, 'clean' => true, 'wrap' => 200);
             $tidy = new tidy();
             //var_dump($value);
             $value = $tidy->repairString($value, $tidyConfig, 'UTF8');
             //var_dump($value);die;
         }
         return $value;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:palmic,项目名称:lbox,代码行数:21,代码来源:class.LBoxFormFilterTidy.php

示例9: tidy_cleaning

 /**
  * tidy html cleaning or valid html tags
  * @param string $string: content of html
  * @param array $tidyConfig: tidy setting (optional)
  */
 public static function tidy_cleaning($string, $tidyConfig = null, $return = '')
 {
     $out = array();
     $config = array('indent' => true, 'show-body-only' => false, 'clean' => true, 'output-xhtml' => true, 'preserve-entities' => true);
     if ($tidyConfig == null) {
         $tidyConfig =& $config;
     }
     if (!class_exists('tidy')) {
         return;
     }
     $tidy = new tidy();
     $out['full'] = $tidy->repairString($string, $tidyConfig, 'UTF8');
     unset($tidy);
     unset($tidyConfig);
     $out['body'] = preg_replace("/.*<body[^>]*>|<\\/body>.*/si", "", $out['full']);
     $out['style'] = '<style type="text/css">' . preg_replace("/.*<style[^>]*>|<\\/style>.*/si", "", $out['full']) . '</style>';
     if ($return && isset($out[$return])) {
         return $out[$return];
     } else {
         return $out;
     }
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:27,代码来源:class-core-string.php

示例10: array

     exit;
     break;
 case 'comment':
     $id = __paramInit('int', 'id');
     if (!$id && !$uid && !isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
         exit;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/articles_comments.php';
     $comment = articles_comments::getComment($id);
     $attaches = articles_comments::getAttaches($id, true);
     $result = array();
     $result['success'] = false;
     if (hasPermissions('articles') || $uid == $comment['from_id']) {
         $comment['msgtext'] = preg_replace("/\\h/", ' ', $comment['msgtext']);
         $tidy = new tidy();
         $comment['msgtext'] = $tidy->repairString(str_replace(array(' '), array('&nbsp;'), iconv('CP1251', 'UTF-8', nl2br($comment['msgtext']))), array('show-body-only' => true, 'wrap' => '0'), 'raw');
         $comment['msgtext'] = preg_replace("/\\h/", ' ', $comment['msgtext']);
         $comment['msgtext'] = preg_replace('/\\n?<br\\s?\\/?>\\n?/', "\n", $comment['msgtext']);
         $comment['msgtext'] = html_entity_decode($comment['msgtext']);
         $result['success'] = true;
         $result['data'] = $comment;
         $result['attaches'] = $attaches;
     }
     echo json_encode($result);
     exit;
     break;
 default:
     $content = 'content_index.php';
     //        $page = __paramInit('int', 'p');
     //        if (!$page) $page = 1;
     if (isset($_GET['tag'])) {
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php

示例11: repair_html

/**
 * Восстанавливает html (закрывает незакрытые теги, правильно расставляет теги и т.д.)
 * при помощи tidy
 *
 * @param string $input Html код
 * @return string       Восстановленный html-код
 */
function repair_html($input)
{
    $input = preg_replace("/(li|ol|ul)>[\n]+/iU", "\$1>", $input);
    $tidy = new tidy();
    $input = $tidy->repairString(str_replace(array(' '), array('&nbsp;'), nl2br($input)), array('show-body-only' => true, 'wrap' => '0'), 'raw');
    $input = str_replace("\n", "", $input);
    $input = preg_replace("/\\h/", " ", $input);
    return $input;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:16,代码来源:stdf.php

示例12: cleaning

function cleaning($string_to_clean = null, $tidy_config = null)
{
    $config = array('show-body-only' => false, 'clean' => true, 'char-encoding' => 'utf8', 'add-xml-decl' => true, 'add-xml-space' => true, 'output-html' => false, 'output-xml' => false, 'output-xhtml' => true, 'numeric-entities' => false, 'ascii-chars' => false, 'doctype' => 'strict', 'bare' => true, 'fix-uri' => true, 'indent' => true, 'indent-spaces' => 4, 'tab-size' => 4, 'wrap-attributes' => true, 'wrap' => 0, 'indent-attributes' => true, 'join-classes' => false, 'join-styles' => false, 'enclose-block-text' => true, 'fix-bad-comments' => true, 'fix-backslash' => true, 'replace-color' => false, 'wrap-asp' => false, 'wrap-jste' => false, 'wrap-php' => false, 'write-back' => true, 'drop-proprietary-attributes' => false, 'hide-comments' => false, 'hide-endtags' => false, 'literal-attributes' => false, 'drop-empty-paras' => true, 'enclose-text' => true, 'quote-ampersand' => true, 'quote-marks' => false, 'quote-nbsp' => true, 'vertical-space' => true, 'wrap-script-literals' => false, 'tidy-mark' => true, 'merge-divs' => false, 'repeated-attributes' => 'keep-last', 'break-before-br' => true);
    if ($tidy_config == null) {
        $tidy_config = $config;
    }
    $tidy = new tidy();
    $out = $tidy->repairString($string_to_clean, $tidy_config, 'utf8');
    unset($tidy, $tidy_config);
    return $out;
}
开发者ID:Clansuite,项目名称:IRC-Logbot,代码行数:11,代码来源:calendar.php

示例13: tidyHTML

 /**
  * Tidy сжирает память, не рекомендуется пользоваться данной возможностью
  *
  * TODO: разобраться с проблемами памяти в tydy_parse_string
  *
  * @param $sHTML
  * @param array $aOpts
  * @return bool|string
  */
 protected function tidyHTML($sHTML, $aOpts = array())
 {
     if (!empty($aOpts)) {
         $this->setTidyOptions($aOpts);
     }
     $tidy = new tidy();
     $sHTML = $tidy->parseString($sHTML);
     $sHTML = $tidy->repairString($sHTML);
     $sHTML = tidy_parse_string($sHTML, $this->aTidyOptions);
     return $sHTML;
 }
开发者ID:rgen3,项目名称:html_parser,代码行数:20,代码来源:abstractParser.php

示例14: cleanHTML

function cleanHTML($html)
{
    $tidy = new tidy();
    return $tidy->repairString($html, array('show-body-only' => true, 'output-html' => true, 'indent' => true), 'UTF8');
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:5,代码来源:MY_string_helper.php

示例15: boookattach


//.........这里部分代码省略.........
\t</p>
\t<p>\t\t
\t\tMay we take this opportunity of thanking you for your enquiry, and we do hope that we are able to assist you in fulfilling your requirements.
\t</p>
</div>
EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    $tbl = <<<EOD
<div style="margin-top:20px;text-align:center;">\t
\t<small>
\t\t* All costings are subject to a final confirmation which will be given upon making a firm reservation *
\t</small>
</div><br/><br/>
EOD;
    $pdf->writeHTML($tbl, true, false, false, false, '');
    /*$tbl = '
    <div style="margin-top:20px;width:100%;display:inline-flex;">	
    	<div style="color:blue;text-align:center;width:60%">BookItNow Travel is a trading name of broadway Travel Services (Wimbledon) Ltd. Whose registered office is at Unit 1,Finway,Dallow Road,Luton,Beds LUI 1WE</div>
    	<div> <img src="'.base_url().'/images/abta.png"/></div>
    </div>';
    $pdf->writeHTML($tbl, true, false, false, false, '');*/
    //echo $tbl;exit;
    $tbl = '
<div style="margin-top:20px;">
	<span>Yours sincerely</span>
	<p>' . @$results['pdfdata']['adviser_info']['name'] . '</p>
</div>';
    $pdf->writeHTML($tbl, true, false, false, false, '');
    if (!empty($results['hobjs'])) {
        // $hotel_meta = new SimpleXMLElement(download_page('http://87.102.127.86:8005/search/websearch.exe?pageid=7&compid=1&brochurecode=BEWE-AMTSES1CO0'));
        $hotel_meta = new SimpleXMLElement(download_page('http://87.102.127.86:8005/search/websearch.exe?pageid=7&compid=1&brochurecode=' . $results['hobjs'][0]['@attributes']['brocode']));
        $i = 1;
        $desc = urldecode($hotel_meta->HotelDescription);
        $ty = new tidy();
        $desc = $ty->repairString($desc);
        $tbl = '<br /><br/><br/><br/><h2 style="text-align:center; "pagebreak="true">Accommodation Info</h2><table>';
        foreach ($hotel_meta->Images->Url as $img) {
            $tbl .= '<tr>';
            //Allow_url_fopen must be On
            if (is_array(@getimagesize(urldecode($img)))) {
                $tbl .= '<td colspan="1"  style="margin-right: 30px !important;"><img src="' . urldecode($img) . '" /></td>';
            } else {
                $tbl .= '<td colspan="3"><img src="' . base_url() . '/images/destination_placeholder.jpg"/></td>';
            }
            $tbl .= '<td colspan="1"></td>';
            if ($i == 1) {
                $tbl .= '<td rowspan="' . count($hotel_meta->Images->Url) . '" colspan="8">' . $desc . '</td>';
            }
            $tbl .= '</tr>';
            //$tbl .= '<style>.desc{background:red;}</style>';
            $i++;
        }
        $tbl .= '</table>';
        //echo $tbl;exit;
        $pdf->writeHTML($tbl, true, false, false, false, '');
    }
    // ---------------------------------------------------------
    // Close and output PDF document
    // This method has several options, check the source code documentation for more information.
    //$pdf->Output('D:\xampp\htdocs\test_plugins\tcpdf\examples\example_001.pdf', 'F');
    if ($type == 'email') {
        $pdf->Output(getcwd() . '/booking_files/' . $results['pdfdata']['adviser_info']['reference'] . '.pdf', 'F');
        if (file_exists(getcwd() . '/booking_files/' . $results['pdfdata']['adviser_info']['reference'] . '.pdf')) {
            $subject = 'Quick Quote Ref: ' . $results['pdfdata']['adviser_info']['reference'] . ' - Book it now';
            $body = 'Dear ' . $t['fname'][0];
            $body .= '<p></p>';
            $body .= '<p>Please find the attached document</p>';
            $body .= '<p></p>';
            $body .= '<p>Cheers</p>';
            $body .= '<p>BootItNow</p>';
            $from = 'prattipati.satyanarayana@gmail.com';
            $sendername = "BookItNow Admin";
            $list = array($results['row'][0]['email']);
            $config['protocol'] = "smtp";
            $config['smtp_host'] = 'mail.expertwebworx.in';
            $config['smtp_port'] = '25';
            $config['smtp_user'] = 'campusxroads@expertwebworx.in';
            $config['smtp_pass'] = 'C}BA,RI25#c_c%UopsdW9neX';
            $config['smtp_crypto'] = 'tls';
            $config['charset'] = "iso-8859-1";
            $config['mailtype'] = "html";
            $ci->load->library('email', $config);
            $ci->email->set_newline("\r\n");
            $ci->email->from($from, $sendername);
            $ci->email->to($list);
            $ci->email->reply_to($from, $sendername);
            $ci->email->subject($subject);
            $ci->email->attach(getcwd() . '/booking_files/' . $results['pdfdata']['adviser_info']['reference'] . '.pdf');
            $ci->email->message($body);
            if ($ci->email->send()) {
            }
        }
    } else {
        $pdf->Output($results['pdfdata']['adviser_info']['reference'] . '.pdf', 'D');
        exit;
    }
    //============================================================+
    // END OF FILE
    //============================================================+
}
开发者ID:bogiesoft,项目名称:bookitnow,代码行数:101,代码来源:common_helper.php


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