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


PHP tidy::isXML方法代码示例

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


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

示例1: foreach

 }
 foreach ($xpath->query('//version') as $node) {
     if ($node instanceof DOMElement) {
         $node->appendChild($dom->createTextNode('.1'));
         //hack to trigger an update for 4.1.10 release due translations not being loaded on updates
     }
 }
 $results = $xpath->query('//*[@locale]');
 for ($i = 0; $i < $results->length; $i++) {
     $results->item($i)->setAttribute('locale', $locale);
 }
 $out = $dom->saveXML();
 if (function_exists('tidy_get_output')) {
     $tidy = new tidy();
     $tidy_config = array('input-xml' => true, 'output-xml' => true, 'indent' => true, 'wrap' => 0);
     $tidy->isXML();
     $tidy->parseString($out, $tidy_config, 'UTF8');
     $tidy->cleanRepair();
     $out = tidy_get_output($tidy);
 }
 if ($booleans['create_archive']) {
     $cwd = realpath(getcwd());
     $c_path = realpath($configs[$module]);
     if (strpos($c_path, $cwd) !== 0) {
         I2CE::raiseError("Cannot determine module sub-directory structure for {$module}", E_USER_ERROR);
     }
     $target_dir = $archive_dir . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . substr($c_path, strlen($cwd)) . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR;
 } else {
     $target_dir = $configs[$module] . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR;
 }
 if (!is_dir($target_dir)) {
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:translate_templates.php

示例2: getDisplay

 /**
  * Returns the displayed page as a (tidy!) string
  * @returns string
  */
 public function getDisplay()
 {
     $out = $this->doc->saveXML();
     if (function_exists('tidy_get_output')) {
         $tidy = new tidy();
         $config = array('input-xml' => true, 'output-xml' => true, 'indent' => true, 'wrap' => 0);
         $tidy->isXML();
         $tidy->parseString($out, $config);
         $tidy->cleanRepair();
         $out = tidy_get_output($tidy);
     }
     return $out;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:17,代码来源:I2CE_TemplateMeister.php

示例3: createConfigFile


//.........这里部分代码省略.........
            $imports[] = $import;
            if ($t_node->parentNode->tagName == 'I2CEConfiguration') {
                //$import and $t_node are the top-level configurationGroup.  this should only happen once
                $import->setAttribute('locale', I2CE_Locales::DEFAULT_LOCALE);
                $i2ceconfig->appendChild($import);
                if ($burned) {
                    I2CE::raiseError("Burned in {$module} ");
                    return false;
                }
                $burned = true;
                break;
                //out of while
            } else {
                if ($t_node->parentNode->tagName == 'metadata') {
                    $import->setAttribute('locale', I2CE_Locales::DEFAULT_LOCALE);
                    switch ($import->tagName) {
                        case 'description':
                            $desc = $import;
                            $meta->insertBefore($desc, $version);
                            break 2;
                            //out of while
                        //out of while
                        case 'category':
                            $cat = $import;
                            if ($desc instanceof DOMElement) {
                                $meta->insertBefore($cat, $desc);
                            } else {
                                $meta->insertBefore($cat, $version);
                            }
                            break 2;
                            //out of while
                        //out of while
                        case 'displayName':
                            $disp = $import;
                            if ($cat instanceof DOMElement) {
                                $meta->insertBefore($disp, $cat);
                            } else {
                                if ($desc instanceof DOMElement) {
                                    $meta->insertBefore($disp, $desc);
                                } else {
                                    $meta->insertBefore($disp, $version);
                                }
                            }
                            break 2;
                            //out of while
                        //out of while
                        default:
                            I2CE::raiseError("Unexpected tag " . $import->tagName . " in metadata");
                            return false;
                    }
                }
            }
            $t_node = $t_node->parentNode;
            if (!$t_node instanceof DOMElement) {
                I2CE::raiseError("Expected element but not gotten in {$module}.  ");
                return false;
            }
            $t_import = $import;
            $import = $trans->importNode($t_node, false);
            foreach (array('name', 'path', 'values', 'type', 'config') as $attr) {
                if ($t_node->hasAttribute($attr)) {
                    $import->setAttribute($attr, $t_node->getAttribute($attr));
                }
            }
            //check for <status>version:XXXX</status>
            $statii = $dom_xpath->query('./status', $t_node);
            for ($j = 0; $j < $statii->length; $j++) {
                $status = $statii->item($j);
                if (preg_match('/^version:.+$/', trim($status->textContent), $matches)) {
                    $import->appendChild($trans->createElement('status', trim($status->textContent)));
                }
            }
        }
    }
    if (!$trans->documentElement->hasChildNodes()) {
        //should be exactly one, the top-level configurationGroup
        I2CE::raiseError("Was not able to extract translatable strings from {$file} for {$module} ");
        return false;
    }
    $results = $xpath->query('/I2CEConfiguration/configurationGroup');
    if ($results->length > 0) {
        $version_node = $trans->createElement('version', $storage->config->data->{$module}->version);
        $results->item(0)->insertBefore($version_node, $results->item(0)->firstChild);
    }
    $out = $trans->saveXML();
    if (function_exists('tidy_get_output')) {
        $tidy = new tidy();
        $tidy_config = array('input-xml' => true, 'output-xml' => true, 'indent' => true, 'wrap' => 0);
        $tidy->isXML();
        $tidy->parseString($out, $tidy_config, 'UTF8');
        $tidy->cleanRepair();
        $out = tidy_get_output($tidy);
    }
    I2CE::raiseError("Creating {$config}");
    if (!file_put_contents($config, $out)) {
        I2CE::raiseError("Could not save {$config} for {$module}  ");
        return false;
    }
    return true;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:101,代码来源:translate_base.php

示例4: getDisplay

 /**
  * Returns the displayed page as a string
  * @returns string
  */
 public function getDisplay()
 {
     return $this->doc->saveHTML();
     if (function_exists('tidy_get_output')) {
         $this->removeProprietaryAttr();
         $out = $this->doc->saveHTML();
         //$out = htmlentities($out,ENT_COMPAT,'UTF-8');
         $tidy = new tidy();
         $config = array('indent' => true, 'wrap' => 0, 'quote-ampersand' => false, 'numeric-entities' => false, 'quote-marks' => false, 'preserve-entities' => false, 'output-html' => false, 'output-xml' => false, 'output-xhtml' => true, 'char-encoding' => 'utf8', 'input-encoding' => 'utf8', 'output-encoding' => 'utf8', 'input-xml' => false);
         $tidy->isXML();
         $tidy->parseString($out, $config, 'UTF8');
         $tidy->cleanRepair();
         $out = tidy_get_output($tidy);
         return $out;
     } else {
         return $this->doc->saveHTML();
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:22,代码来源:I2CE_Template.php

示例5: getDisplay

 /**
  * Returns the displayed page as a (tidy!) string
  * @param boolean $decode_entities Set if you want to decode HTML
  *                                 entities back to the original
  *                                 ignoring HTML specialchars
  * @param int $decode_flags default is ENT_NOQUOTES
  * @returns string
  */
 public function getDisplay($decode_entities = false, $decode_flags = ENT_NOQUOTES)
 {
     $out = $this->doc->saveXML();
     if (function_exists('tidy_get_output')) {
         $tidy = new tidy();
         $config = array('input-xml' => true, 'output-xml' => true, 'indent' => true, 'wrap' => 0);
         $tidy->isXML();
         $tidy->parseString($out, $config);
         $tidy->cleanRepair();
         $out = tidy_get_output($tidy);
     }
     if ($decode_entities) {
         foreach (get_html_translation_table(HTML_SPECIALCHARS, $decode_flags) as $code) {
             $out = str_replace($code, htmlspecialchars($code), $out);
         }
         return html_entity_decode($out, $decode_flags);
     } else {
         return $out;
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:28,代码来源:I2CE_TemplateMeister.php


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