Skip to content

Commit 6b567f8

Browse files
author
John Coggeshall
committed
Completely re-wrote the ZE2 OO stuff to do it the proper way. It is not
considerably more stable, cleaner, and looks as if it works well :) This probably is going to break any scripts which used it before, but oh well.
1 parent 55d9ec0 commit 6b567f8

File tree

2 files changed

+442
-63
lines changed

2 files changed

+442
-63
lines changed

ext/tidy/php_tidy.h

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,17 @@ extern zend_module_entry tidy_module_entry;
8383
INIT_CLASS_ENTRY(ce, "tidy_" # name, tidy_funcs_ ## name); \
8484
ce.create_object = tidy_object_new_ ## name; \
8585
tidy_ce_ ## name = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
86-
memcpy(&tidy_object_handlers_ ## name, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
86+
tidy_ce_ ## name->ce_flags |= ZEND_ACC_FINAL_CLASS; \
87+
memcpy(&tidy_object_handlers_ ## name, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
8788
tidy_object_handlers_ ## name.clone_obj = NULL; \
88-
}
89+
}
90+
91+
#define GET_THIS_CONTAINER() \
92+
PHPTidyObj *obj; \
93+
{ \
94+
zval *object = getThis(); \
95+
obj = (PHPTidyObj *)zend_object_store_get_object(object TSRMLS_CC); \
96+
}
8997

9098
typedef enum {
9199
is_node,
@@ -147,16 +155,25 @@ PHP_FUNCTION(tidy_get_html);
147155
PHP_FUNCTION(tidy_get_head);
148156
PHP_FUNCTION(tidy_get_body);
149157

150-
PHP_NODE_METHOD(type);
151-
PHP_NODE_METHOD(name);
152-
PHP_NODE_METHOD(value);
153-
PHP_NODE_METHOD(id);
158+
PHP_NODE_METHOD(__construct);
154159
PHP_NODE_METHOD(attributes);
155160
PHP_NODE_METHOD(children);
156161

157-
PHP_ATTR_METHOD(name);
158-
PHP_ATTR_METHOD(value);
159-
PHP_ATTR_METHOD(id);
162+
PHP_NODE_METHOD(has_children);
163+
PHP_NODE_METHOD(has_siblings);
164+
PHP_NODE_METHOD(is_comment);
165+
PHP_NODE_METHOD(is_html);
166+
PHP_NODE_METHOD(is_xhtml);
167+
PHP_NODE_METHOD(is_xml);
168+
PHP_NODE_METHOD(is_text);
169+
PHP_NODE_METHOD(is_jste);
170+
PHP_NODE_METHOD(is_asp);
171+
PHP_NODE_METHOD(is_php);
172+
173+
PHP_NODE_METHOD(next);
174+
PHP_NODE_METHOD(prev);
175+
PHP_NODE_METHOD(get_attr);
176+
PHP_NODE_METHOD(get_nodes);
160177

161178
/* resource dtor */
162179
void dtor_TidyDoc(zend_rsrc_list_entry * TSRMLS_DC);

0 commit comments

Comments
 (0)