cvs: php-src /ext/tidy php_tidy.h tidy.c /ext/tidy/tests tidy_019.phpt

From: Date: Thu, 23 Mar 2006 14:22:40 +0000
Subject: cvs: php-src /ext/tidy php_tidy.h tidy.c /ext/tidy/tests tidy_019.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-37453@lists.php.net to get a copy of this message
john Thu Mar 23 14:22:40 2006 UTC Added files: /php-src/ext/tidy/tests tidy_019.phpt Modified files: /php-src/ext/tidy php_tidy.h tidy.c Log: Under threat of being slept with by Marcus, adding new getParent() method for node traversals http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/php_tidy.h?r1=1.27&r2=1.28&diff_format=u Index: php-src/ext/tidy/php_tidy.h diff -u php-src/ext/tidy/php_tidy.h:1.27 php-src/ext/tidy/php_tidy.h:1.28 --- php-src/ext/tidy/php_tidy.h:1.27 Sun Jan 1 13:09:56 2006 +++ php-src/ext/tidy/php_tidy.h Thu Mar 23 14:22:40 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_tidy.h,v 1.27 2006/01/01 13:09:56 sniper Exp $ */ +/* $Id: php_tidy.h,v 1.28 2006/03/23 14:22:40 john Exp $ */ #ifndef PHP_TIDY_H #define PHP_TIDY_H @@ -89,6 +89,7 @@ TIDY_NODE_METHOD(isJste); TIDY_NODE_METHOD(isAsp); TIDY_NODE_METHOD(isPhp); +TIDY_NODE_METHOD(getParent); ZEND_BEGIN_MODULE_GLOBALS(tidy) char *default_config; http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.76&r2=1.77&diff_format=u Index: php-src/ext/tidy/tidy.c diff -u php-src/ext/tidy/tidy.c:1.76 php-src/ext/tidy/tidy.c:1.77 --- php-src/ext/tidy/tidy.c:1.76 Wed Mar 8 14:41:45 2006 +++ php-src/ext/tidy/tidy.c Thu Mar 23 14:22:40 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tidy.c,v 1.76 2006/03/08 14:41:45 iliaa Exp $ */ +/* $Id: tidy.c,v 1.77 2006/03/23 14:22:40 john Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -302,6 +302,7 @@ TIDY_NODE_ME(isJste, NULL) TIDY_NODE_ME(isAsp, NULL) TIDY_NODE_ME(isPhp, NULL) + TIDY_NODE_ME(getParent, NULL) {NULL, NULL, NULL} }; @@ -982,7 +983,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Tidy support", "enabled"); php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate()); - php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.76 2006/03/08 14:41:45 iliaa Exp $)"); + php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.77 2006/03/23 14:22:40 john Exp $)"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -1696,6 +1697,30 @@ } /* }}} */ +/* {{{ proto boolean tidyNode::getParent() + Returns the parent node if available or NULL */ +TIDY_NODE_METHOD(getParent) +{ + TidyNode parent_node; + PHPTidyObj *newobj; + TIDY_FETCH_ONLY_OBJECT; + + parent_node = tidyGetParent(obj->node); + if(parent_node) { + tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC); + newobj = (PHPTidyObj *) zend_object_store_get_object(return_value TSRMLS_CC); + newobj->node = parent_node; + newobj->type = is_node; + newobj->ptdoc = obj->ptdoc; + newobj->ptdoc->ref_count++; + tidy_add_default_properties(newobj, is_node TSRMLS_CC); + } else { + ZVAL_NULL(return_value); + } +} +/* }}} */ + + static void _php_tidy_register_nodetypes(INIT_FUNC_ARGS) { TIDY_NODE_CONST(ROOT, Root); http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tests/tidy_019.phpt?view=markup&rev=1.1 Index: php-src/ext/tidy/tests/tidy_019.phpt +++ php-src/ext/tidy/tests/tidy_019.phpt --TEST-- Test getParent() --SKIPIF-- <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php $x = tidy_parse_string("<body><div>Content</div></body>"); var_dump($x->body()->child[0]->getParent()->name); ?> --EXPECT-- string(4) "body"

« previous php.cvs (#37453) next »