PluginProbe
ANAC XML Bandi di Gara / 2.1
ANAC XML Bandi di Gara v2.1
7.8 trunk 0.1 1.0.0.1 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.1.1 1.1.2 2.0 2.0.1 2.0.2 2.0.3 2.1 2.2 2.3 2.3.1 3 3.0.1 3.1 3.1.1 3.1.2 3.1.3 All 57 releases
avcp / valid_page.php

valid_page.php in ANAC XML Bandi di Gara 2.1, at valid_page.php

60 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 add_action('admin_menu', 'avcp_valid_menu');
3 function avcp_valid_menu()
4 {
5 add_submenu_page('edit.php?post_type=avcp', 'Validazione Dataset', 'Validazione Dataset', 'manage_options', 'avcp_v_dataset', 'avcp_v_dataset_load');
6 }
7
8 function avcp_v_dataset_load()
9 {
10 echo '<div class="wrap">';
11 screen_icon();
12 echo '<h2>Validazione Dataset XML</h2><em>Tramite questa funzione � possibile verificare dei dataset .xml con le specifiche di Avcp; non � tuttavia garantito il controllo della completezza/veridicit� dei dati inseriti/omessi</em>';
13 $terms = get_terms( 'annirif', array('hide_empty' => 0) );
14 foreach ( $terms as $term ) {
15 $xml = new DOMDocument();
16 $xml->load(get_site_url() . '/avcp/' . $term->name. '.xml');
17 echo '<hr><h3>Dataset Anno ' . $term->name . ' >>> <a href="' . get_site_url() . '/avcp/' . $term->name. '.xml">' . get_site_url() . '/avcp/' . $term->name. '.xml</a></h3>';
18 if (!$xml->schemaValidate(get_site_url() . '/wp-content/plugins/avcp/includes/datasetAppaltiL190.xsd')) {
19 libxml_display_errors();
20 } else {
21 echo 'Valido!';
22 }
23 }
24 echo '</div>';
25 }
26
27 function libxml_display_error($error)
28 {
29 $return = "<br/>\n";
30 switch ($error->level) {
31 case LIBXML_ERR_WARNING:
32 $return .= "<b>Warning $error->code</b>: ";
33 break;
34 case LIBXML_ERR_ERROR:
35 $return .= "<b>Error $error->code</b>: ";
36 break;
37 case LIBXML_ERR_FATAL:
38 $return .= "<b>Fatal Error $error->code</b>: ";
39 break;
40 }
41 $return .= trim($error->message);
42 if ($error->file) {
43 $return .= " in <b>$error->file</b>";
44 }
45 $return .= " on line <b>$error->line</b>\n";
46
47 return $return;
48 }
49
50 function libxml_display_errors() {
51 $errors = libxml_get_errors();
52 foreach ($errors as $error) {
53 print libxml_display_error($error);
54 }
55 libxml_clear_errors();
56 }
57 // Enable user error handling
58 libxml_use_internal_errors(true);
59
60 ?>