1<?php
2
3class CSSPseudoLinkTarget extends CSSPropertyHandler {
4  function CSSPseudoLinkTarget() { $this->CSSPropertyHandler(true, true); }
5
6  function default_value() { return ""; }
7
8  function is_external_link($value) {
9    return (strlen($value) > 0 && $value{0} != "#");
10  }
11
12  function is_local_link($value) {
13    return (strlen($value) > 0 && $value{0} == "#");
14  }
15
16  function parse($value, &$pipeline) {
17    // Keep local links (starting with sharp sign) as-is
18    if (CSSPseudoLinkTarget::is_local_link($value)) { return $value; }
19
20    $data = @parse_url($value);
21    if (!isset($data['scheme']) || $data['scheme'] == "" || $data['scheme'] == "http") {
22      return $pipeline->guess_url($value);
23    } else {
24      return $value;
25    };
26  }
27
28  function get_property_code() {
29    return CSS_HTML2PS_LINK_TARGET;
30  }
31
32  function get_property_name() {
33    return '-html2ps-link-target';
34  }
35}
36
37CSS::register_css_property(new CSSPseudoLinkTarget);
38
39?>