Ejemplo n.º 1
0
 /**
  * Replacement for htmlspecialchars(). Can parse arrays.
  *
  * @param   string  $s Any string or array.
  */
 function gw_htmlspecialchars($s)
 {
     if (is_array($s)) {
         /* can't use array_walk() on byself with reference */
         for (reset($s); list($k, $v) = each($s);) {
             $s[$k] = gw_htmlspecialchars($v);
         }
         return $s;
     } elseif (is_string($s)) {
         $s = htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
     }
     return $s;
 }
 }
 /* Nested fields (trsp, trns, abbr ...) */
 $cnt_child = 0;
 foreach ($odefn->children() as $ochild) {
     $xmltag = $ochild->getName();
     /* Include supported fields only */
     if (isset($gw18_ar_id_fields[$xmltag]) && $gw18_ar_id_fields[$xmltag] !== false) {
         $xmltag = $gw18_ar_id_fields[$xmltag];
         $value_child = (string) $ochild;
         /* Filter Item */
         $item_filtered = $this->o->items__filter($value_child);
         /* Construct alphabetic order */
         $q__contents[$xmltag][$cnt_child] = $this->o->get_az_index($item_filtered, $value_child, $id_lang);
         $q__contents[$xmltag][$cnt_child]['contents_value'] = strip_tags($value_child);
         /* No Wiki */
         $q__contents[$xmltag][$cnt_child]['contents_value_cached'] = gw_htmlspecialchars($q__contents[$xmltag][$cnt_child]['contents_value']);
         $q__contents[$xmltag][$cnt_child]['id_contents'] = $id_contents_max;
         $q__contents[$xmltag][$cnt_child]['id_item'] = $id_item_max;
         $q__contents[$xmltag][$cnt_child]['id_field'] = $xmltag;
         $q__contents[$xmltag][$cnt_child]['id_user_created'] = $this->o->oSess->id_user;
         $q__contents[$xmltag][$cnt_child]['id_user_modified'] = 0;
         $q__contents[$xmltag][$cnt_child]['id_lang'] = $id_lang;
         $q__contents[$xmltag][$cnt_child]['cnt_bytes'] = strlen($q__contents[$xmltag][$cnt_child]['contents_value']);
         $q__contents[$xmltag][$cnt_child]['cnt_words'] = $this->o->count_words($q__contents[$xmltag][$cnt_child]['contents_value']);
         ++$cnt_child;
         ++$id_contents_max;
     }
 }
 if (empty($q__contents[$id_field])) {
     unset($q__contents[$id_field]);
 }