function decodeRequestParams() { $params = array(); // Apply caller specific params foreach ($this->owa_params as $k => $v) { if (is_array($v)) { array_walk_recursive($v, array($this, 'arrayUrlDecode')); $params[$k] = $v; } else { $params[$k] = urldecode($v); } } // clean params after decode $params = owa_lib::inputFilter($params); // replace owa params $this->owa_params = $params; //debug owa_coreAPI::debug('decoded OWA params: ' . print_r($this->owa_params, true)); return; }
/** * Creates a text snippet of the portion of page where the * specific link is found. * * Takes fully qualified URL for the link to search for. * * @param string $link * @return string */ function extract_anchor_snippet($link) { // Search the page for a specific anchor $this->extract_anchor($link); if (!empty($this->anchor_info['anchor_tag'])) { // drop certain HTML entitities and their content $nohtml = $this->strip_selected_tags($this->response, array('title', 'head', 'script', 'object', 'style', 'meta', 'link', 'rdf:'), true); //$this->e->debug('Refering page content after certain html entities were dropped: '.$this->results); // calc len of the anchor text $atext_len = strlen($this->anchor_info['anchor_tag']); // find position within document of the anchor text $start = strpos($nohtml, $this->anchor_info['anchor_tag']); if ($start < $this->snip_len) { $part1_start_pos = 0; $part1_snip_len = $start; } else { $part1_start_pos = $start; $part1_snip_len = $this->snip_len; } $replace_items = array("\r\n", "\n\n", "\t", "\r", "\n"); // Create first segment of snippet $first_part = substr($nohtml, 0, $part1_start_pos); $first_part = str_replace($replace_items, '', $first_part); $first_part = strip_tags(owa_lib::inputFilter($first_part)); //$part1 = trim(substr($nohtml, $part1_start_pos, $part1_snip_len)); $part1 = substr($first_part, -$part1_snip_len, $part1_snip_len); //$part1 = str_replace(array('\r\n', '\n\n', '\t', '\r', '\n'), '', $part1); //$part1 = owa_lib::inputFilter($part1); // Create second segment of snippet $part2 = trim(substr($nohtml, $start + $atext_len, $this->snip_len + 300)); $part2 = str_replace($replace_items, '', $part2); $part2 = substr(strip_tags(owa_lib::inputFilter($part2)), 0, $this->snip_len); // Put humpty dumpy back together again and create actual snippet $snippet = $this->snip_str . $part1 . ' <span class="snippet_anchor">' . owa_lib::inputFilter($this->anchor_info['anchor_tag']) . '</span> ' . $part2 . $this->snip_str; } else { $snippet = ''; } return $snippet; }
function cleanProperties() { return $this->setProperties(owa_lib::inputFilter($this->getProperties())); }