backward.php
8 years ago
get_taxonomies_by_object_type.php
8 years ago
pmxe_filter.php
8 years ago
pmxe_functions.php
8 years ago
pmxe_render_xml_attributes.php
8 years ago
pmxe_render_xml_element.php
8 years ago
pmxe_render_xml_text.php
8 years ago
str_getcsv.php
8 years ago
wp_all_export_check_children_assign.php
8 years ago
wp_all_export_generate_export_file.php
8 years ago
wp_all_export_get_cpt_name.php
8 years ago
wp_all_export_get_export_format.php
8 years ago
wp_all_export_is_compatible.php
8 years ago
wp_all_export_parse_field_name.php
8 years ago
wp_all_export_posts_join.php
8 years ago
wp_all_export_posts_where.php
8 years ago
wp_all_export_prepare_template_csv.php
8 years ago
wp_all_export_prepare_template_xml.php
8 years ago
wp_all_export_rand_char.php
8 years ago
wp_all_export_remove_colons.php
8 years ago
wp_all_export_remove_source.php
8 years ago
wp_all_export_reverse_rules_html.php
8 years ago
wp_all_export_rmdir.php
8 years ago
wp_all_export_secure_file.php
8 years ago
wp_all_export_url_title.php
8 years ago
wp_all_export_write_article.php
8 years ago
wp_redirect_or_javascript.php
8 years ago
pmxe_render_xml_element.php
55 lines
| 1 | <?php |
| 2 | function pmxe_render_xml_element($el, $shorten = false, $path = '/', $ind = 1, $lvl = 0) |
| 3 | { |
| 4 | $path .= $el->nodeName; |
| 5 | $alternativePath = $path; |
| 6 | if ( ! $el->parentNode instanceof DOMDocument and $ind > 0) { |
| 7 | $path .= "[$ind]"; |
| 8 | } |
| 9 | |
| 10 | echo '<div class="xml-element lvl-' . $lvl . ' lvl-mod4-' . ($lvl % 4) . '" title="' . $path . '">'; |
| 11 | //if ($el->hasAttributes()){ |
| 12 | //echo '<div class="xml-element-xpaths">'; self::render_element_xpaths($el, $alternativePath, $ind, $lvl); echo '</div>'; |
| 13 | //} |
| 14 | if ($el->hasChildNodes()) { |
| 15 | $is_render_collapsed = $ind > 1; |
| 16 | if ($el->childNodes->length > 1 or ! $el->childNodes->item(0) instanceof DOMText or strlen(trim($el->childNodes->item(0)->wholeText)) > 40) { |
| 17 | echo '<div class="xml-expander">' . ($is_render_collapsed ? '+' : '-') . '</div>'; |
| 18 | } |
| 19 | echo '<div class="xml-tag opening"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; pmxe_render_xml_attributes($el, $path . '/'); echo '></div>'; |
| 20 | if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) { |
| 21 | pmxe_render_xml_text(trim($el->childNodes->item(0)->wholeText), $shorten, $is_render_collapsed); |
| 22 | } else { |
| 23 | echo '<div class="xml-content' . ($is_render_collapsed ? ' collapsed' : '') . '">'; |
| 24 | $indexes = array(); |
| 25 | foreach ($el->childNodes as $eli => $child) { |
| 26 | if ($child instanceof DOMElement) { |
| 27 | empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 0; $indexes[$child->nodeName]++; |
| 28 | pmxe_render_xml_element($child, $shorten, $path . '/', $indexes[$child->nodeName], $lvl + 1); |
| 29 | } elseif ($child instanceof DOMCdataSection) { |
| 30 | pmxe_render_xml_text(trim($child->wholeText), $shorten, false, true); |
| 31 | } elseif ($child instanceof DOMText) { |
| 32 | if ( $el->childNodes->item($eli - 1) and ($el->childNodes->item($eli - 1) instanceof DOMCdataSection) ){ |
| 33 | |
| 34 | } |
| 35 | elseif( $el->childNodes->item($eli + 1) and ($el->childNodes->item($eli + 1) instanceof DOMCdataSection) ){ |
| 36 | |
| 37 | } |
| 38 | else{ |
| 39 | pmxe_render_xml_text(trim($child->wholeText), $shorten); |
| 40 | } |
| 41 | } elseif ($child instanceof DOMComment) { |
| 42 | if (preg_match('%\[pmxi_more:(\d+)\]%', $child->nodeValue, $mtch)) { |
| 43 | $no = intval($mtch[1]); |
| 44 | echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'wp_all_import_plugin'), $no, _n('element', 'elements', $no, 'wp_all_import_plugin')) . ' ⇓ ]</div>'; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | echo '</div>'; |
| 49 | } |
| 50 | echo '<div class="xml-tag closing"></<span class="xml-tag-name">' . $el->nodeName . '</span>></div>'; |
| 51 | } else { |
| 52 | echo '<div class="xml-tag opening empty"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; pmxe_render_xml_attributes($el); echo '/></div>'; |
| 53 | } |
| 54 | echo '</div>'; |
| 55 | } |