Ejemplo n.º 1
0
 public function getId()
 {
     return $this->_domElement->getAttribute('id');
 }
Ejemplo n.º 2
0
 protected function parseHtmlNode(DomNode $node, $output)
 {
     $tag = $node->tagName;
     switch ($tag) {
         case 'br':
             return "\n";
         case 'b':
         case 'strong':
             return "[b]{$output}[/b]";
         case 'i':
         case 'em':
             return "[i]{$output}[/i]";
         case 'u':
             return "[u]{$output}[/u]";
         case 'span':
             $style = $node->getAttribute('style');
             if ($style == 'text-decoration: underline;') {
                 $output = "[u]{$output}[/u]";
             }
             return $output;
         case 'a':
             return "[url={$node->getAttribute('href')}]{$output}[/url]";
         case 'img':
             return "[img]{$node->getAttribute('src')}[/img]";
         case 'address':
             return "{$output}";
         case 'h1':
             return "\n[size=6]{$output}[/size]";
         case 'h2':
             return "\n[size=5]{$output}[/size]";
         case 'h3':
             return "\n[size=4]{$output}[/size]";
         case 'h4':
             return "\n[size=3]{$output}[/size]";
         case 'h5':
             return "\n[size=2]{$output}[/size]";
         case 'h6':
             return "\n[size=1]{$output}[/size]";
         case 'pre':
         case 'li':
         case 'ul':
         case 'ol':
             return "\n[{$tag}]{$output}[/{$tag}]";
         case 'hr':
             return "\n[hr]";
         case 'p':
             $output = trim($output);
             if (!$output) {
                 return;
             }
             $style = $node->getAttribute('style');
             if ($node->getAttribute('class' == 'caption')) {
                 $output = "[center]{$output}[/center]";
             } elseif ($style == 'text-align: left;') {
                 $output = "[left]{$output}[/left]";
             } elseif ($style == 'text-align: center;') {
                 $output = "[center]{$output}[/center]";
             } elseif ($style == 'text-align: right;') {
                 $output = "[right]{$output}[/right]";
             }
             return "\n{$output}";
         case 'div':
         default:
             return "{$output}";
     }
 }
 /**
  * Test if this node is a match based on the node type and URL format.
  *
  * @param DomNode $node
  * @param string $pattern
  * @return boolean
  * @static
  * @access public
  */
 public static function is_embed_web_video($node, $pattern)
 {
     return 'p' == $node->nodeName && preg_match($pattern, trim($node->nodeValue)) || 'iframe' == $node->nodeName && preg_match($pattern, trim($node->getAttribute('src')));
 }
Ejemplo n.º 4
0
 /**
  * Returns an associative array containing the possible values of a
  * <configspecial> tag as used inside of enum configurations.
  *
  * @param DomNode $node  The DomNode representation of the <configspecial>
  *                       tag.
  *
  * @return array  An associative array with the possible values.
  */
 protected function _handleSpecials($node)
 {
     $app = $node->getAttribute('application');
     try {
         if (!in_array($app, $GLOBALS['registry']->listApps())) {
             $app = $GLOBALS['registry']->hasInterface($app);
         }
     } catch (Horde_Exception $e) {
         return array();
     }
     if (!$app) {
         return array();
     }
     try {
         return $GLOBALS['registry']->callAppMethod($app, 'configSpecialValues', array('args' => array($node->getAttribute('name')), 'noperms' => true));
     } catch (Horde_Exception $e) {
         return array();
     }
 }
Ejemplo n.º 5
0
 /**
  * @param DomDocument $dom The DomNode of the form
  * @param PGPage $page The parent PGPage object
  * @return PGForm
  */
 function __construct($dom, $page)
 {
     $this->page = $page;
     $this->browser = $this->page->browser;
     $this->dom = $dom;
     $this->method = strtolower($this->dom->getAttribute('method'));
     if (empty($this->method)) {
         $this->method = 'get';
     }
     $this->enctype = strtolower($this->dom->getAttribute('enctype'));
     if (empty($this->enctype)) {
         $this->enctype = '';
     }
     $this->action = phpUri::parse($this->page->url)->join($this->dom->getAttribute('action'));
     $this->initFields();
 }
Ejemplo n.º 6
0
 /**
  * load classes
  */
 private function load()
 {
     $this->classes = array();
     $content = $this->node instanceof \DOMElement ? $this->node->getAttribute('class') : '';
     foreach (explode(" ", $content) as $class) {
         if (trim($class)) {
             $this->classes[trim($class)] = trim($class);
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * Format a single OAI error response as a text message
  * @param  DomNode $node
  * @return string
  */
 function oaiErrorMessage($node)
 {
     $code = $node->getAttribute('code');
     $text = $node->textContent;
     return "{$code}: {$text}";
 }
Ejemplo n.º 8
0
 /**
  * Hyperlinks are not yet supported in Article Format markdown. Ignore for
  * now.
  *
  * @param DomNode $node
  * @return string
  * @access private
  */
 private function parse_hyperlink_node($node)
 {
     $url = esc_url_raw(apply_filters('apple_news_markdown_hyperlink', $node->getAttribute('href')));
     return '[' . $this->parse_nodes($node->childNodes) . '](' . $url . ')';
 }
 /**
  * Hyperlinks are not yet supported in Article Format markdown. Ignore for
  * now.
  *
  * @param DomNode $node
  * @return string
  * @access private
  */
 private function parse_hyperlink_node($node)
 {
     $url = $node->getAttribute('href');
     return '[' . $this->parse_nodes($node->childNodes) . '](' . $url . ')';
 }