Re: [PHP] pdflib: unable to generate on the fly, need to write to file
On Wed, Jan 24, 2001 at 11:21:28AM -0600, Dominic wrote: > I have successfully installed pdflib with PHP4.0.4pl1 and all the > necessary components. However, I don't know how to output a generated > pdf to the browser without writing it to disk first and then reading it > in. Below are the examples that I use. > > This example tries to directly output the pdf to the browser and doesn't > work. The browser says "An error has occured while trying to use this > document." In case you use pdflib 3.03 check the pdflib page for a patch. There is a bug if you create documents in memory. Uwe -- [EMAIL PROTECTED] Tel: +2331 987 4528Fax: +2331 987 375 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Fri Jan 26 00:15:58 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - changed naming of some functions (kept compatibility) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.25 php4/ext/domxml/php_domxml.c:1.26 --- php4/ext/domxml/php_domxml.c:1.25 Fri Jan 12 08:49:06 2001 +++ php4/ext/domxml/php_domxml.cFri Jan 26 00:15:57 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.25 2001/01/12 16:49:06 sniper Exp $ */ +/* $Id: php_domxml.c,v 1.26 2001/01/26 08:15:57 steinm Exp $ */ #include "php.h" @@ -62,8 +62,10 @@ PHP_FE(domxml_add_root, NULL) PHP_FE(domxml_dumpmem, NULL) PHP_FE(domxml_attributes, NULL) - PHP_FE(domxml_getattr, NULL) - PHP_FE(domxml_setattr, NULL) + PHP_FE(domxml_get_attribute,NULL) + PHP_FALIAS(domxml_getattr, domxml_get_attribute, NULL) + PHP_FE(domxml_set_attribute,NULL) + PHP_FALIAS(domxml_setattr, domxml_set_attribute, NULL) PHP_FE(domxml_children, NULL) PHP_FE(domxml_new_child,NULL) PHP_FE(domxml_node, NULL) @@ -102,12 +104,15 @@ }; static zend_function_entry php_domxmlnode_class_functions[] = { - PHP_FALIAS(lastchild, domxml_lastchild, NULL) + PHP_FALIAS(lastchild, domxml_last_child, NULL) + PHP_FALIAS(last_child, domxml_last_child, NULL) PHP_FALIAS(children,domxml_children,NULL) PHP_FALIAS(parent, domxml_parent, NULL) PHP_FALIAS(new_child, domxml_new_child, NULL) - PHP_FALIAS(getattr, domxml_getattr, NULL) - PHP_FALIAS(setattr, domxml_setattr, NULL) + PHP_FALIAS(getattr, domxml_get_attribute, NULL) + PHP_FALIAS(get_attribute, domxml_get_attribute, NULL) + PHP_FALIAS(setattr, domxml_set_attribute, NULL) + PHP_FALIAS(set_attribute, domxml_set_attribute, NULL) PHP_FALIAS(attributes, domxml_attributes, NULL) PHP_FALIAS(node,domxml_node,NULL) PHP_FALIAS(set_content, domxml_set_content, NULL) @@ -529,9 +534,9 @@ } /* }}} */ -/* {{{ proto object domxml_lastchild([int node]) +/* {{{ proto object domxml_last_child([int node]) Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_lastchild) +PHP_FUNCTION(domxml_last_child) { zval *id, **tmp; xmlNode *nodep, *last; @@ -697,9 +702,9 @@ } /* }}} */ -/* {{{ proto string domxml_getattr([int node,] string attrname) +/* {{{ proto string domxml_get_attribute([int node,] string attrname) Returns value of given attribute */ -PHP_FUNCTION(domxml_getattr) +PHP_FUNCTION(domxml_get_attribute) { zval *id, *arg1, **tmp; xmlNode *nodep; @@ -737,9 +742,9 @@ } /* }}} */ -/* {{{ proto bool domxml_setattr([int node,] string attrname, string value) +/* {{{ proto bool domxml_set_attribute([int node,] string attrname, string value) Sets value of given attribute */ -PHP_FUNCTION(domxml_setattr) +PHP_FUNCTION(domxml_set_attribute) { zval *id, *arg1, *arg2, **tmp; xmlNode *nodep; @@ -1061,8 +1066,12 @@ add_property_resource(return_value, "doc", ret); if(docp->name) add_property_stringl(return_value, "name", (char *) docp->name, strlen(docp->name), 1); + else + add_property_stringl(return_value, "name", "", 0, 1); if(docp->URL) add_property_stringl(return_value, "url", (char *) docp->URL, strlen(docp->URL), 1); + else + add_property_stringl(return_value, "url", "", 0, 1); add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1); if(docp->encoding) add_property_stringl(return_value, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1); Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.19 php4/ext/domxml/php_domxml.h:1.20 --- php4/ext/domxml/php_domxml.h:1.19 Fri Dec 8 19:19:46 2000 +++ php4/ext/domxml/php_domxml.hFri Jan 26 00:15:57 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.h,v 1.19 2000/12/09 03:19:46 sniper Exp $ */ +/* $Id: php_domxml.h,v 1.20 2001/01/26 08:15:57 steinm Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -49,10 +49,10 @@ /* Class Node methods */ PHP_FUNCTION(domxml_attributes); -PHP_FUNCTION(domxml_getattr); -PHP_FUNCTION(domxml_setattr); +PHP_FUNCTION(domxml_get_attribute); +PHP_FUNCTION(domxml_set_attribute); PHP_FUNCTION(domxml_children); -PHP_FUNCTION(domxml_lastchild); +PHP_FUNCTION(domxml_last_child); PHP_FUNCTION(domxml_parent); PHP_FUNCTION(domxml_node); PHP_FUNCTION(do
[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
steinm Fri Jan 26 00:20:23 2001 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: - This is major change of the php pdf api to be closer to the pdflib api done by Rainer Schaaf from pdflib GmbH. - Some more functions has been implemented as well. - backwards compatibility has been maintained a much as possible Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.65 php4/ext/pdf/pdf.c:1.66 --- php4/ext/pdf/pdf.c:1.65 Wed Jan 3 08:52:59 2001 +++ php4/ext/pdf/pdf.c Fri Jan 26 00:20:23 2001 @@ -16,10 +16,10 @@ +--+ */ -/* $Id: pdf.c,v 1.65 2001/01/03 16:52:59 sniper Exp $ */ +/* $Id: pdf.c,v 1.66 2001/01/26 08:20:23 steinm Exp $ */ -/* pdflib 2.02 is subject to the ALADDIN FREE PUBLIC LICENSE. - Copyright (C) 1997 Thomas Merz. */ +/* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. + Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ /* Note that there is no code from the pdflib package in this file */ #include "php.h" @@ -46,93 +46,134 @@ #include "php_pdf.h" -static int le_pdf_image, le_outline, le_pdf; +static int le_pdf; +/* + * to adopt the php way of error handling to PDFlib + * The image related functions in PDFlib return -1 on error + * but they may return 0 (FALSE) in normal cases + * so this offset will repair this + */ +#define PDFLIB_IMAGE_OFFSET1 +#define PDFLIB_FONT_OFFSET 1 + function_entry pdf_functions[] = { - PHP_FE(pdf_set_info,NULL) - PHP_FE(pdf_set_info_creator,NULL) /* deprecated */ - PHP_FE(pdf_set_info_title, NULL) /* deprecated */ - PHP_FE(pdf_set_info_subject,NULL) /* deprecated */ - PHP_FE(pdf_set_info_author, NULL) /* deprecated */ - PHP_FE(pdf_set_info_keywords, NULL) /* deprecated */ - PHP_FE(pdf_open,NULL) - PHP_FE(pdf_close, NULL) - PHP_FE(pdf_begin_page, NULL) - PHP_FE(pdf_end_page,NULL) - PHP_FE(pdf_show,NULL) - PHP_FE(pdf_show_xy, NULL) - PHP_FE(pdf_show_boxed, NULL) - PHP_FE(pdf_skew,NULL) - PHP_FE(pdf_set_font,NULL) - PHP_FE(pdf_set_leading, NULL) /* deprecated */ - PHP_FE(pdf_set_text_rendering, NULL) /* deprecated */ - PHP_FE(pdf_set_horiz_scaling, NULL) /* deprecated */ - PHP_FE(pdf_set_text_rise, NULL) /* deprecated */ - PHP_FE(pdf_set_text_pos,NULL) - PHP_FE(pdf_set_char_spacing,NULL) /* deprecated */ - PHP_FE(pdf_set_word_spacing,NULL) /* deprecated */ - PHP_FE(pdf_get_font,NULL) - PHP_FE(pdf_get_fontname,NULL) - PHP_FE(pdf_get_fontsize,NULL) - PHP_FE(pdf_continue_text, NULL) - PHP_FE(pdf_stringwidth, NULL) - PHP_FE(pdf_save,NULL) - PHP_FE(pdf_restore, NULL) - PHP_FE(pdf_translate, NULL) - PHP_FE(pdf_scale, NULL) - PHP_FE(pdf_rotate, NULL) - PHP_FE(pdf_setflat, NULL) - PHP_FE(pdf_setlinejoin, NULL) - PHP_FE(pdf_setlinecap, NULL) - PHP_FE(pdf_setmiterlimit, NULL) - PHP_FE(pdf_setlinewidth,NULL) - PHP_FE(pdf_setdash, NULL) - PHP_FE(pdf_moveto, NULL) - PHP_FE(pdf_lineto, NULL) - PHP_FE(pdf_curveto, NULL) - PHP_FE(pdf_circle, NULL) - PHP_FE(pdf_arc, NULL) - PHP_FE(pdf_rect,NULL) - PHP_FE(pdf_closepath, NULL) - PHP_FE(pdf_stroke, NULL) - PHP_FE(pdf_closepath_stroke,NULL) - PHP_FE(pdf_fill,NULL) - PHP_FE(pdf_fill_stroke, NULL) - PHP_FE(pdf_closepath_fill_stroke, NULL) - PHP_FE(pdf_endpath, NULL) - PHP_FE(pdf_clip,NULL) - PHP_FE(pdf_set_parameter, NULL) - PHP_FE(pdf_get_parameter, NULL) - PHP_FE(pdf_set_value, NULL) - PHP_FE(pdf_get_value, NULL) - PHP_FE(pdf_setgray_fill,NULL) - PHP_FE(pdf_setgray_stroke, NULL) - PHP_FE(pd
[PHP-CVS] cvs: php4 /ext/hyperwave hw.c
steinm Thu Feb 22 01:38:59 2001 EDT Modified files: /php4/ext/hyperwave hw.c Log: - took out the HwSLS_FETCH to make it compile again on Unix Is this really neccesary at this point? Index: php4/ext/hyperwave/hw.c diff -u php4/ext/hyperwave/hw.c:1.76 php4/ext/hyperwave/hw.c:1.77 --- php4/ext/hyperwave/hw.c:1.76Tue Feb 20 12:45:53 2001 +++ php4/ext/hyperwave/hw.c Thu Feb 22 01:38:58 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hw.c,v 1.76 2001/02/20 20:45:53 dbeu Exp $ */ +/* $Id: hw.c,v 1.77 2001/02/22 09:38:58 steinm Exp $ */ #include #include @@ -146,7 +146,7 @@ void _close_hw_link(zend_rsrc_list_entry *rsrc) { - HwSLS_FETCH(); +/* HwSLS_FETCH(); */ hw_connection *conn = (hw_connection *)rsrc->ptr; if(conn->hostname) free(conn->hostname); @@ -159,7 +159,7 @@ void _close_hw_plink(zend_rsrc_list_entry *rsrc) { - HwSLS_FETCH(); +/* HwSLS_FETCH(); */ hw_connection *conn = (hw_connection *)rsrc->ptr; if(conn->hostname) free(conn->hostname); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/hyperwave hw.c
steinm Tue Mar 13 22:33:46 2001 EDT Modified files: /php4/ext/hyperwave hw.c Log: -fixed prototype and indention Index: php4/ext/hyperwave/hw.c diff -u php4/ext/hyperwave/hw.c:1.79 php4/ext/hyperwave/hw.c:1.80 --- php4/ext/hyperwave/hw.c:1.79Sun Feb 25 22:06:57 2001 +++ php4/ext/hyperwave/hw.c Tue Mar 13 22:33:45 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hw.c,v 1.79 2001/02/26 06:06:57 andi Exp $ */ +/* $Id: hw.c,v 1.80 2001/03/14 06:33:45 steinm Exp $ */ #include #include @@ -244,7 +244,7 @@ } hidden = collhead = fullcollhead = total = 0; -collheadnr = fullcollheadnr = -1; + collheadnr = fullcollheadnr = -1; for(i=0; ivalue.ht; - if(0 == (count = zend_hash_num_elements(lht))) + if(0 == (count = zend_hash_num_elements(lht))) { RETURN_FALSE; + } ids = emalloc(count * sizeof(hw_objectID)); zend_hash_internal_pointer_reset(lht); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Abobe FDF and PHP
On Thu, Mar 15, 2001 at 01:17:38AM -0500, Dustin Leggans wrote: > Hello, > > My internet provider does not have the $HTTP_POST_VARS variable enabled... > What would be the easiest way to capture submitted PDF form data without > having this variable? > According to the source the latest php does provide all field as php variables similar to html form fields. This means you wouldn't need HTTP_POST_VARS. Uwe -- [EMAIL PROTECTED] Tel: +2331 987 4528Fax: +2331 987 375 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/hyperwave hg_comm.c hg_comm.h
steinm Fri Mar 16 09:40:38 2001 EDT Modified files: /php4/ext/hyperwave hg_comm.c hg_comm.h Log: - Inserting links without any delimiters is now possible Index: php4/ext/hyperwave/hg_comm.c diff -u php4/ext/hyperwave/hg_comm.c:1.39 php4/ext/hyperwave/hg_comm.c:1.40 --- php4/ext/hyperwave/hg_comm.c:1.39 Sun Feb 25 22:06:57 2001 +++ php4/ext/hyperwave/hg_comm.cFri Mar 16 09:40:37 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hg_comm.c,v 1.39 2001/02/26 06:06:57 andi Exp $ */ +/* $Id: hg_comm.c,v 1.40 2001/03/16 17:40:37 steinm Exp $ */ /* #define HW_DEBUG */ @@ -523,6 +523,19 @@ if(strncmp(str, "background", 10) == 0) cur_ptr->linktype=HW_BACKGROUND_LINK; else + if(strncmp(str, "intagnodel", 10) == +0) { /* New type introduced by Uwe Steinmann 16.03.2001 */ + +cur_ptr->linktype=HW_INTAGNODEL_LINK; + cur_ptr->tagattr = NULL; + if(NULL != (str = +strstr(object, "TagAttr="))) { + str += 8; + str1 = str; + while((*str1 != '\n') +&& (*str1 != '\0')) + str1++; + cur_ptr->tagattr = +emalloc(str1 - str + 1); + +memcpy(cur_ptr->tagattr, str, str1 - str); + cur_ptr->tagattr[str1 +- str] = '\0'; + } + } else if(strncmp(str, "intag", 5) == 0) { cur_ptr->linktype=HW_INTAG_LINK; cur_ptr->tagattr = NULL; @@ -695,6 +708,11 @@ offset -= 4; /* because there is no closing tag */ /* laststart = cur_ptr->start; */ break; + case HW_INTAGNODEL_LINK: + snprintf(istr, BUFFERLEN, "%s", +cur_ptr->link); + offset -= 4; /* because there is no +closing tag */ +/* laststart = cur_ptr->start; */ + break; case HW_APPLET_LINK: if(cur_ptr->codebase) snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'", cur_ptr->codebase, cur_ptr->code); @@ -727,7 +745,10 @@ else snprintf(istr, BUFFERLEN, " %s='%s/%s'", cur_ptr->tagattr, scriptname[HW_INTAG_LINK], cur_ptr->destdocname); offset -= 4; /* because there is no closing tag */ -/* laststart = cur_ptr->start; */ + break; + case HW_INTAGNODEL_LINK: + snprintf(istr, BUFFERLEN, "%s", +cur_ptr->destdocname); + offset -= 4; /* because there is no +closing tag */ break; case HW_APPLET_LINK: if(cur_ptr->codebase) Index: php4/ext/hyperwave/hg_comm.h diff -u php4/ext/hyperwave/hg_comm.h:1.13 php4/ext/hyperwave/hg_comm.h:1.14 --- php4/ext/hyperwave/hg_comm.h:1.13 Sun Feb 25 22:06:57 2001 +++ php4/ext/hyperwave/hg_comm.hFri Mar 16 09:40:37 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hg_comm.h,v 1.13 2001/02/26 06:06:57 andi Exp $ */ +/* $Id: hg_comm.h,v 1.14 2001/03/16 17:40:37 steinm Exp $ */ #ifndef HG_COMM_H #define HG_COMM_H @@ -85,6 +85,7 @@
[PHP-CVS] cvs: php4 /tests testdom
steinm Tue Mar 20 07:02:11 2001 EDT Modified files: /php4/tests testdom Log: - test script for rewritten domxml module Index: php4/tests/testdom diff -u php4/tests/testdom:1.18 php4/tests/testdom:1.19 --- php4/tests/testdom:1.18 Fri Nov 10 02:28:30 2000 +++ php4/tests/testdom Tue Mar 20 07:02:10 2001 @@ -1,49 +1,4 @@ type) { -case XML_ELEMENT_NODE: - for($i=0; $i<$level; $i++) -echo " "; - echo "<".$node->name; - $attributes = $node->attributes(); - if(is_array($attributes)) { -//var_dump($attributes); -foreach($attributes as $attribute) - echo " ".$attribute->name."=".$node->getattr($attribute->name); - } - echo ">\n"; - $children = $node->children(); - for($i=0; $i < count($children); $i++) -output_node($children[$i], $level+1); - for($i=0; $i<$level; $i++) -echo " "; - echo "name.">\n"; - break; -case XML_TEXT_NODE: - for($i=0; $i<$level; $i++) -echo " "; - echo $node->content; - break; -case XML_ENTITY_REF_NODE: - echo $node->content; - break; -case XML_COMMENT_NODE: - for($i=0; $i<$level; $i++) -echo " "; - echo ""; - echo "\n"; - break; - } -} - -function list_attr($node) { - $attr = domxml_attributes($node); - for(reset($attr); $key = key($attr); next($attr)) { -echo $key."=".$attr[$key]."\n"; - } -} - $xmlstr = " @@ -65,69 +20,54 @@ "; -/* The following code traverses the xml tree node by node - by using the methods of the xmlnode object -*/ echo "Test 1: accessing single nodes from php\n"; -if(!$dom = xmldoc($xmlstr)) { +$dom = xmldoc($xmlstr); +if(!$dom) { echo "Error while parsing the document\n"; exit; } -echo "XML Version: ".$dom->version."\n"; -echo "Standalone: ".$dom->standalone."\n"; -$dtd = $dom->dtd(); -$rootnode = $dom->children(); -foreach($rootnode as $root) - output_node($root); -$rootnode = $dom->root(); - output_node($rootnode); - -/* This one creates a dom tree made of php objects */ -echo "Test 2: creating a tree with php objects\n"; -$dom = xmltree($xmlstr); -$dom->root->name = "section"; -echo $dom->root->name; -echo "\n"; -/* xmltree() creates a tree which is readonly. This means that a - function like - $dom->root->new_child("TEST", "ljdf"); - won't work -*/ - -/* The following builds a xml document from scratch */ -echo "Test 3: building a xml document from scratch\n"; -$doc = new_xmldoc("1.0"); -$root = $doc->add_root("HTML"); -$head = $root->new_child("HEAD", ""); -$head->new_child("TITLE", "Hier der Titel"); -$body = $root->new_child("BODY", ""); -$table = $body->new_child("TABLE", ""); -$table->setattr("WIDTH", "100%"); -$table->new_child("TR", " "); -echo $doc->dumpmem(); - -/* The following does some testing of the xpath support */ -echo "Test 4: See if XPath works\n"; -if(!$dom = xmldoc($xmlstr)) { - echo "Error while parsing the document\n"; - exit; -} -if(false === ($xpathctx = xpath_new_context($dom))) { - echo "Error in xpath_new_context()\n"; - exit; -} +$children = $dom->childNodes(); +print_r($children); + +echo "- root\n"; +$rootnode = $dom->documentElement(); +print_r($rootnode); + +echo "- children of root\n"; +$children = $rootnode->childNodes(); +print_r($children); + +// The last node should be identical with the last entry in the children array +echo "- last\n"; +$last = $rootnode->lastChild(); +print_r($last); + +// The parent of this last node is the root again +echo "- parent\n"; +$parent = $last->parent(); +print_r($parent); + +// The children of this parent are the same children as one above +echo "- children of parent\n"; +$children = $parent->childNodes(); +print_r($children); + +echo "- creating a new attribute\n"; +$attr = $dom->createAttribute("src", "picture.gif"); +print_r($attr); + +$rootnode->setAttributeNode($attr); /* Not implemented */ +$attr = $rootnode->setAttribute("src", "picture.gif"); +$attr = $rootnode->getAttribute("src"); +print_r($attr); + +echo "- attribute of rootnode\n"; +$attrs = $rootnode->attributes(); +print_r($attrs); + +echo "- children of an attribute\n"; +$children = $attrs[0]->childNodes(); +print_r($children); -/* What you get back is an object of type XPathObject. - Depending on the sub type of XPathObject, the property - 'value' or 'nodeset' contains the result. - The sub type is in property 'type'. - See docs for libxml for valid types. - 1 means XPATH_NODESET which is in PHP an array of DomNodes. -*/ -$xpathobj = xpath_eval($xpathctx, "/child::*"); -echo $xpathobj->type."\n"; -var_dump($xpathobj); -foreach($xpathobj->nodeset as $node) - echo $node->name."\n"; ?> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PRO
[PHP-CVS] cvs: php4 / NEWS
steinm Tue Mar 20 07:03:33 2001 EDT Modified files: /php4 NEWS Log: - news about domxml Index: php4/NEWS diff -u php4/NEWS:1.615 php4/NEWS:1.616 --- php4/NEWS:1.615 Mon Mar 19 18:09:17 2001 +++ php4/NEWS Tue Mar 20 07:03:33 2001 @@ -2,6 +2,7 @@ ||| ?? ??? 200?, Version 4.0.6 +- rewrite of domxml. It's now mostly DOM Level 2 conform (Uwe) - Added array_map() function that applies a callback to the elements of given arrays and returns the result. It can also be used with a null callback to transpose arrays. (Andrei) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Tue Mar 20 07:01:14 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - complete rewrite of domxml module. It is now mostly conform to DOM Level 2 though some classes and methods are still missing Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.28 php4/ext/domxml/php_domxml.c:1.29 --- php4/ext/domxml/php_domxml.c:1.28 Sun Feb 25 22:06:53 2001 +++ php4/ext/domxml/php_domxml.cTue Mar 20 07:01:13 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.28 2001/02/26 06:06:53 andi Exp $ */ +/* $Id: php_domxml.c,v 1.29 2001/03/20 15:01:13 steinm Exp $ */ #include "php.h" @@ -24,33 +24,46 @@ #if HAVE_DOMXML #include "ext/standard/info.h" -/*#define newcode*/ #define PHP_XPATH 1 #define PHP_XPTR 2 static int le_domxmldocp; +static int le_domxmldoctypep; static int le_domxmldtdp; static int le_domxmlnodep; +static int le_domxmlelementp; static int le_domxmlattrp; -/* static int le_domxmlnsp; */ +static int le_domxmlcdatap; +static int le_domxmltextp; +static int le_domxmlpip; +static int le_domxmlcommentp; +static int le_domxmlentityp; +static int le_domxmlnsp; #if defined(LIBXML_XPATH_ENABLED) static int le_xpathctxp; static int le_xpathobjectp; -static zend_class_entry *xpathctx_class_entry_ptr; -static zend_class_entry *xpathobject_class_entry_ptr; #endif -static zend_class_entry *domxmldoc_class_entry_ptr; -static zend_class_entry *domxmldtd_class_entry_ptr; -static zend_class_entry *domxmlnode_class_entry_ptr; -static zend_class_entry *domxmlattr_class_entry_ptr; -static zend_class_entry *domxmlns_class_entry_ptr; - -#ifdef newcode -static zend_class_entry *domxmltestnode_class_entry_ptr; +zend_class_entry *domxmldoc_class_entry; +zend_class_entry *domxmldoctype_class_entry; +zend_class_entry *domxmlelement_class_entry; +zend_class_entry *domxmldtd_class_entry; +zend_class_entry *domxmlnode_class_entry; +zend_class_entry *domxmlattr_class_entry; +zend_class_entry *domxmlcdata_class_entry; +zend_class_entry *domxmltext_class_entry; +zend_class_entry *domxmlpi_class_entry; +zend_class_entry *domxmlcomment_class_entry; +zend_class_entry *domxmlnotation_class_entry; +zend_class_entry *domxmlentity_class_entry; +zend_class_entry *domxmlns_class_entry; +#if defined(LIBXML_XPATH_ENABLED) +zend_class_entry *xpathctx_class_entry; +zend_class_entry *xpathobject_class_entry; #endif + static int node_attributes(zval **attributes, xmlNode *nodep); static int node_children(zval **children, xmlNode *nodep); @@ -58,19 +71,26 @@ PHP_FE(xmldoc, NULL) PHP_FE(xmldocfile, NULL) PHP_FE(xmltree, NULL) - PHP_FE(domxml_root, NULL) + PHP_FALIAS(domxml_root, domxml_doc_document_element, NULL) PHP_FE(domxml_add_root, NULL) PHP_FE(domxml_dumpmem, NULL) - PHP_FE(domxml_attributes, NULL) - PHP_FE(domxml_get_attribute,NULL) - PHP_FALIAS(domxml_getattr, domxml_get_attribute, NULL) - PHP_FE(domxml_set_attribute,NULL) - PHP_FALIAS(domxml_setattr, domxml_set_attribute, NULL) - PHP_FE(domxml_children, NULL) - PHP_FE(domxml_new_child,NULL) + PHP_FE(domxml_node_attributes, NULL) + PHP_FALIAS(domxml_attributes, domxml_node_attributes, NULL) + PHP_FE(domxml_elem_get_attribute, NULL) + PHP_FALIAS(domxml_get_attribute,domxml_elem_get_attribute, NULL) + PHP_FALIAS(domxml_getattr, domxml_elem_get_attribute, NULL) + PHP_FE(domxml_elem_set_attribute, NULL) + PHP_FALIAS(domxml_set_attribute,domxml_elem_set_attribute, NULL) + PHP_FALIAS(domxml_setattr, domxml_elem_set_attribute, NULL) + PHP_FE(domxml_node_children,NULL) + PHP_FALIAS(domxml_children, domxml_node_children, NULL) + PHP_FE(domxml_node_new_child, NULL) + PHP_FALIAS(domxml_new_child,domxml_node_new_child, NULL) PHP_FE(domxml_node, NULL) - PHP_FE(domxml_unlink_node, NULL) - PHP_FE(domxml_set_content, NULL) + PHP_FE(domxml_node_unlink_node, NULL) + PHP_FALIAS(domxml_unlink_node, domxml_node_unlink_node, NULL) + PHP_FE(domxml_node_set_content, NULL) + PHP_FALIAS(set_content, domxml_node_set_content,NULL) PHP_FE(domxml_new_xmldoc, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) #if defined(LIBXML_XPATH_ENABLED) @@ -86,41 +106,151 @@ }; -static zend_function_entry php_domxmldoc_class_functions[] = { - PHP_FALIAS(root,domxml_root,NULL) - PHP_FALIAS(children,domxml_children,NULL) +static function_entry php_domxmldoc_class_functions[] = { +// PHP_FALIAS(domdocument, xmldoc, NULL) + {"domdocument", PHP_FN(xmldoc), NULL}, + PHP_FALIAS(doctype, domxml_doc_doctype, NU
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
steinm Tue Mar 20 08:20:43 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: - fixed lot of compiler warnings Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.29 php4/ext/domxml/php_domxml.c:1.30 --- php4/ext/domxml/php_domxml.c:1.29 Tue Mar 20 07:01:13 2001 +++ php4/ext/domxml/php_domxml.cTue Mar 20 08:20:42 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.29 2001/03/20 15:01:13 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.30 2001/03/20 16:20:42 steinm Exp $ */ #include "php.h" @@ -968,7 +968,7 @@ PHP_FUNCTION(domxml_node_name) { zval *id; - xmlNode *n, *first; + xmlNode *n; const char *str = NULL; id = getThis(); @@ -1173,7 +1173,6 @@ { zval *id; xmlNode *nodep; - int ret; id = getThis(); if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0))) @@ -1193,7 +1192,6 @@ { zval *id; xmlNode *nodep; - int ret; id = getThis(); if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0))) @@ -1260,9 +1258,8 @@ Returns list of children nodes */ PHP_FUNCTION(domxml_node_children) { - zval *id, **tmp; + zval *id; xmlNode *nodep, *last; - xmlDoc *docp; int ret; id = getThis(); @@ -1296,9 +1293,8 @@ Deletes node */ PHP_FUNCTION(domxml_node_unlink_node) { - zval *id, **tmp; - xmlNode *nodep, *last; - int ret; + zval *id; + xmlNode *nodep; id = getThis(); nodep = php_dom_get_object(id, le_domxmlnodep, 0); @@ -1393,7 +1389,7 @@ Sets name of a node */ PHP_FUNCTION(domxml_node_set_name) { - zval *id, *name, **tmp; + zval *id, *name; xmlNode *nodep; if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &name) == FAILURE) { @@ -1415,7 +1411,7 @@ Returns list of attributes of node */ PHP_FUNCTION(domxml_node_attributes) { - zval *id, **tmp; + zval *id; xmlNode *nodep; #ifdef oldstyle_for_libxml_1_8_7 xmlAttr *attr; @@ -1449,7 +1445,7 @@ Adds child node to parent node */ PHP_FUNCTION(domxml_node_new_child) { - zval *id, *name, *content, **tmp, *rv; + zval *id, *name, *content, *rv; xmlNodePtr child, nodep; int ret; @@ -1479,7 +1475,7 @@ Set content of a node */ PHP_FUNCTION(domxml_node_set_content) { - zval *id, *content, **tmp; + zval *id, *content; xmlNode *nodep; if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &content) == FAILURE) { @@ -1531,9 +1527,8 @@ Returns tag name of element node */ PHP_FUNCTION(domxml_elem_tagname) { - zval *id, *arg1, **tmp; + zval *id; xmlNode *nodep; - char *value; id = getThis(); nodep = php_dom_get_object(id, le_domxmlelementp, 0); @@ -1604,7 +1599,6 @@ { zval *id, *arg1; xmlNode *nodep; - char *value; if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) { id = getThis(); @@ -1639,7 +1633,7 @@ /* FIXME: not implemented */ - RETURN_STRING(value, 1); + RETURN_TRUE; } /* }}} */ @@ -1671,7 +1665,6 @@ { zval *id, *arg1; xmlNode *nodep; - char *value; if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) { id = getThis(); @@ -1712,7 +1705,7 @@ Returns DomDocumentType */ PHP_FUNCTION(domxml_doc_doctype) { - zval *arg, *id, *rv; + zval *id, *rv; xmlDtdPtr dtd; xmlDocPtr docp; int ret; @@ -1733,10 +1726,8 @@ Returns DomeDOMImplementation */ PHP_FUNCTION(domxml_doc_implementation) { - zval *arg, *id, *rv; - xmlNode *node; + zval *id; xmlDocPtr docp; - int ret; id = getThis(); if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) { @@ -1877,7 +1868,7 @@ PHP_FUNCTION(domxml_doc_create_attribute) { zval *arg1, *arg2, *id, *rv; - xmlNode *node; + xmlAttrPtr node; xmlDocPtr docp; int ret; @@ -1898,7 +1889,7 @@ } node->doc = docp; - rv = php_domobject_new(node, &ret); + rv = php_domobject_new((xmlNodePtr) node, &ret); SEPARATE_ZVAL(&rv); *return_value = *rv; } @@ -1962,7 +1953,7 @@ Dumps document into string */ PHP_FUNCTION(domxml_dumpmem) { - zval *id, **tmp; + zval *id; xmlDoc *docp; xmlChar *mem; int size; @@ -2054,7 +2045,7 @@ Add string tocontent of a node */ PHP_FUNCTION(domxml_node_text_concat) { - zval *id, *content, **tmp; + zval *id, *content; xmlNode *nodep; if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &content)
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Tue Mar 20 21:45:41 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - added EntityReference and Notation class - fixed handling of PI nodes - implemented more class functions Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.31 php4/ext/domxml/php_domxml.c:1.32 --- php4/ext/domxml/php_domxml.c:1.31 Tue Mar 20 09:04:45 2001 +++ php4/ext/domxml/php_domxml.cTue Mar 20 21:45:40 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.31 2001/03/20 17:04:45 sbergmann Exp $ */ +/* $Id: php_domxml.c,v 1.32 2001/03/21 05:45:40 steinm Exp $ */ #include "php.h" @@ -37,7 +37,9 @@ static int le_domxmltextp; static int le_domxmlpip; static int le_domxmlcommentp; +static int le_domxmlnotationp; static int le_domxmlentityp; +static int le_domxmlentityrefp; static int le_domxmlnsp; #if defined(LIBXML_XPATH_ENABLED) @@ -57,6 +59,7 @@ zend_class_entry *domxmlcomment_class_entry; zend_class_entry *domxmlnotation_class_entry; zend_class_entry *domxmlentity_class_entry; +zend_class_entry *domxmlentityref_class_entry; zend_class_entry *domxmlns_class_entry; #if defined(LIBXML_XPATH_ENABLED) zend_class_entry *xpathctx_class_entry; @@ -126,6 +129,8 @@ PHP_FALIAS(create_processing_instruction, domxml_doc_create_processing_instruction, NULL) PHP_FALIAS(children,domxml_node_children, NULL) PHP_FALIAS(add_root,domxml_add_root,NULL) + PHP_FALIAS(importednode,domxml_doc_imported_node, NULL) + PHP_FALIAS(imported_node, domxml_doc_imported_node, NULL) PHP_FALIAS(dtd, domxml_intdtd, NULL) PHP_FALIAS(dumpmem, domxml_dumpmem, NULL) /* PHP_FALIAS(createcdatasection, domxml_create_cdata_section,NULL) @@ -228,11 +233,15 @@ }; static zend_function_entry php_domxmlnotation_class_functions[] = { -/* PHP_FALIAS(publicid,domxml_notation_public_id, NULL) + PHP_FALIAS(publicid,domxml_notation_public_id, NULL) PHP_FALIAS(public_id, domxml_notation_public_id, NULL) PHP_FALIAS(systemid,domxml_notation_system_id, NULL) PHP_FALIAS(system_id, domxml_notation_system_id, NULL) -*/ {NULL, NULL, NULL} + {NULL, NULL, NULL} +}; + +static zend_function_entry php_domxmlentityref_class_functions[] = { + {NULL, NULL, NULL} }; static zend_function_entry php_domxmlentity_class_functions[] = { @@ -480,9 +489,9 @@ } obj = zend_list_find(Z_LVAL_PP(handle), &type); // The following test should be replaced with search in all parents -// if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) { -// php_error(E_ERROR, "Underlying object missing or of invalid type"); -// } + if (!obj) { // || ((type != rsrc_type1) && (type != rsrc_type2))) { + php_error(E_ERROR, "Underlying object missing or of invalid type"); + } return obj; } @@ -567,7 +576,26 @@ add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1); break; } - case XML_ENTITY_REF_NODE: + case XML_PI_NODE: { + xmlNodePtr nodep = obj; + object_init_ex(wrapper, domxmlpi_class_entry); + rsrc_type = le_domxmlpip; + content = xmlNodeGetContent(nodep); + add_property_stringl(wrapper, "target", (char *) nodep->name, +strlen(nodep->name), 1); + if(content) + add_property_stringl(wrapper, "data", (char *) +content, strlen(content), 1); + break; + } + case XML_ENTITY_REF_NODE: { + xmlNodePtr nodep = obj; + object_init_ex(wrapper, domxmlentityref_class_entry); + rsrc_type = le_domxmlentityrefp; + content = xmlNodeGetContent(nodep); + add_property_stringl(wrapper, "name", (char *) nodep->name, +strlen(nodep->name), 1); + if(content) + add_property_stringl(wrapper, "content", (char *) +content, strlen(content), 1); + break; + } case XML_ENTITY_DECL: case XML_ELEMENT_DECL: { xmlNodePtr nodep = obj; @@ -634,67 +662,6 @@ return(wrapper); } -/* The following has been taken form the gnome gdome module */ -/* This is a separate implementation that avoids the roundtrip entity - encoding/decoding of the current (2000-01-06) gnome-xml - implementation, largely because that depends on node != NULL, w
[PHP-CVS] cvs: php4 /ext/hyperwave hg_comm.c
steinm Tue Mar 20 23:58:20 2001 EDT Modified files: /php4/ext/hyperwave hg_comm.c Log: - fulltext query are working now Index: php4/ext/hyperwave/hg_comm.c diff -u php4/ext/hyperwave/hg_comm.c:1.40 php4/ext/hyperwave/hg_comm.c:1.41 --- php4/ext/hyperwave/hg_comm.c:1.40 Fri Mar 16 09:40:37 2001 +++ php4/ext/hyperwave/hg_comm.cTue Mar 20 23:58:20 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: hg_comm.c,v 1.40 2001/03/16 17:40:37 steinm Exp $ */ +/* $Id: hg_comm.c,v 1.41 2001/03/21 07:58:20 steinm Exp $ */ /* #define HW_DEBUG */ @@ -4392,6 +4392,9 @@ return -1; } if(*ptr++ == 0) { + char *cptr, tmp[20]; + float weight; + int j; *count = (*ptr < maxhits) ? *ptr : maxhits; ptr++; if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID { @@ -4399,8 +4402,18 @@ if(NULL != (*weights = emalloc(*count * sizeof(float { ptr2 = *weights; for(i=0; i<*count; i++) { - ptr1[i] = *ptr++; - ptr2[i] = (float) *ptr++; + ptr1[i] = *ptr++; /* Object id */ + cptr = (char *) ptr; + j = 0; + while(*cptr != ' ') { + tmp[j++] = *cptr++; + } + cptr++; /* Skip space after weight */ + tmp[j] = '\0'; + sscanf(tmp, "%f", &weight); + ptr2[i] = weight; + ptr = (int *) cptr; + ptr++; /* Skip 0-Integer after weight string */ } efree(retmsg->buf); efree(retmsg); @@ -4464,6 +4477,9 @@ return -4; } if(*ptr++ == 0) { + char *cptr, tmp[20]; + float weight; + int j; *count = (*ptr < maxhits) ? *ptr : maxhits; ptr++; if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID { @@ -4471,8 +4487,18 @@ if(NULL != (*weights = emalloc(*count * sizeof(float { ptr2 = *weights; for(i=0; i<*count; i++) { - ptr1[i] = *ptr++; - ptr2[i] = (float) *ptr++; + ptr1[i] = *ptr++; /* Object id */ + cptr = (char *) ptr; + j = 0; + while(*cptr != ' ') { + tmp[j++] = *cptr++; + } + cptr++; /* Skip space after weight */ + tmp[j] = '\0'; + sscanf(tmp, "%f", &weight); + ptr2[i] = weight; + ptr = (int *) cptr; + ptr++; /* Skip 0-Integer after weight string */ } efree(retmsg->buf); efree(retmsg); @@ -4600,6 +4626,9 @@ return -1; } if(*ptr++ == 0) { + char *cptr, tmp[20]; + float weight; + int j; *count = (*ptr < maxhits) ? *ptr : maxhits; ptr++; if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID { @@ -4607,8 +4636,18 @@ if(NULL != (*weights = emalloc(*count * sizeof(float { ptr2 = *weights; for(i=0; i<*count; i++) { - ptr1[i] = *ptr++; - ptr2[i] = (float) *ptr++; + ptr1[i] = *ptr++; /* Object id */ + cptr = (char *) ptr; + j = 0; + while(*cptr != ' ') { + tmp[j++] = *cptr++; + } + cptr++; /* Skip space after weight */ + tmp[j] = '\0'; +
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c
steinm Wed Mar 21 22:58:13 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c Log: - fixed some bugs with xpath Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.32 php4/ext/domxml/php_domxml.c:1.33 --- php4/ext/domxml/php_domxml.c:1.32 Tue Mar 20 21:45:40 2001 +++ php4/ext/domxml/php_domxml.cWed Mar 21 22:58:13 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.32 2001/03/21 05:45:40 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.33 2001/03/22 06:58:13 steinm Exp $ */ #include "php.h" @@ -97,13 +97,13 @@ PHP_FE(domxml_new_xmldoc, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) #if defined(LIBXML_XPATH_ENABLED) - PHP_FE(xpath_new_context, NULL) +/* PHP_FE(xpath_new_context, NULL) PHP_FE(xpath_eval, NULL) - PHP_FE(xpath_eval_expression, NULL) + PHP_FE(xpath_eval_expression, NULL) */ #endif #if defined(LIBXML_XPTR_ENABLED) - PHP_FE(xptr_new_context, NULL) - PHP_FE(xptr_eval, NULL) +/* PHP_FE(xptr_new_context, NULL) + PHP_FE(xptr_eval, NULL) */ #endif {NULL, NULL, NULL} }; @@ -296,24 +296,29 @@ static void php_free_xml_doc(zend_rsrc_list_entry *rsrc) { xmlDoc *doc = (xmlDoc *)rsrc->ptr; - xmlFreeDoc(doc); +/* fprintf(stderr, "Freeing document: %s\n", doc->name); */ + if(doc) + xmlFreeDoc(doc); } -void _free_node(zend_rsrc_list_entry *rsrc) { -/*fprintf(stderr, "Freeing node: %s\n", tmp->name);*/ +void php_free_xml_node(zend_rsrc_list_entry *rsrc) { + xmlNodePtr node = (xmlNodePtr) rsrc->ptr; +/* fprintf(stderr, "Freeing node: %s\n", node->name); */ } #if defined(LIBXML_XPATH_ENABLED) static void php_free_xpath_context(zend_rsrc_list_entry *rsrc) { xmlXPathContextPtr ctx = (xmlXPathContextPtr)rsrc->ptr; - xmlXPathFreeContext(ctx); + if(ctx) + xmlXPathFreeContext(ctx); } static void php_free_xpath_object(zend_rsrc_list_entry *rsrc) { xmlXPathObjectPtr obj = (xmlXPathObjectPtr)rsrc->ptr; - xmlXPathFreeObject(obj); + if(obj) + xmlXPathFreeObject(obj); } #endif @@ -390,7 +395,7 @@ MAKE_STD_ZVAL(wrapper); /* fprintf(stderr, "Adding new XPath Object\n"); */ object_init_ex(wrapper, xpathobject_class_entry); - rsrc_type = le_xpathctxp; + rsrc_type = le_xpathobjectp; php_xpath_set_object(wrapper, (void *) obj, rsrc_type); return(wrapper); @@ -674,7 +679,7 @@ /* Freeing the document contains freeing the complete tree. Therefore nodes, attributes etc. may not be freed seperately. */ - le_domxmlnodep = zend_register_list_destructors_ex(_free_node, NULL, "domnode", module_number); + le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, +"domnode", module_number); le_domxmlattrp = zend_register_list_destructors_ex(NULL, NULL, "domattribute", module_number); #if defined(LIBXML_XPATH_ENABLED) le_xpathctxp = zend_register_list_destructors_ex(php_free_xpath_context, NULL, "xpathcontext", module_number); @@ -2117,7 +2122,7 @@ if (!nodep) { RETURN_FALSE; } - xmlDocSetRootElement(docp, nodep); +// xmlDocSetRootElement(docp, nodep); rv = php_domobject_new(nodep, &ret); SEPARATE_ZVAL(&rv); *return_value = *rv; @@ -2398,9 +2403,8 @@ rv = php_xpathobject_new(xpathobjp, &ret); SEPARATE_ZVAL(&rv); - *return_value = *rv; - add_property_long(return_value, "type", xpathobjp->type); + add_property_long(rv, "type", xpathobjp->type); switch(xpathobjp->type) { case XPATH_UNDEFINED: break; @@ -2411,11 +2415,11 @@ MAKE_STD_ZVAL(arr); if (array_init(arr) == FAILURE) { - xmlXPathFreeObject(xpathobjp); + zval_dtor(rv); RETURN_FALSE; } if(NULL == (nodesetp = xpathobjp->nodesetval)) { - xmlXPathFreeObject(xpathobjp); + zval_dtor(rv); RETURN_FALSE; } @@ -2428,17 +2432,17 @@ child = php_domobject_new(node, &retnode); zend_hash_next_index_insert(arr->value.ht, &child, sizeof(zval *), NULL); } - zend_hash_update(return_value->value.obj.properties, "nodeset", sizeof("nodeset"), (void *) &arr, sizeof(zval *), NULL); + zend_hash_update(rv->value.obj.properties, "nodeset", +sizeof("nodeset"), (void *) &arr, sizeof(zval *), NULL);
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Mon Apr 9 04:53:07 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - added domxml_version() to retrieve version of libxml Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.35 php4/ext/domxml/php_domxml.c:1.36 --- php4/ext/domxml/php_domxml.c:1.35 Wed Mar 28 16:22:45 2001 +++ php4/ext/domxml/php_domxml.cMon Apr 9 04:53:06 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.35 2001/03/29 00:22:45 sniper Exp $ */ +/* $Id: php_domxml.c,v 1.36 2001/04/09 11:53:06 steinm Exp $ */ #include "php.h" @@ -71,6 +71,7 @@ static int node_children(zval **children, xmlNode *nodep); static zend_function_entry domxml_functions[] = { + PHP_FE(domxml_version, NULL) PHP_FE(xmldoc, NULL) PHP_FE(xmldocfile, NULL) PHP_FE(xmltree, NULL) @@ -2482,6 +2483,15 @@ } /* }}} */ #endif /* LIBXML_XPTR_ENABLED */ + +/* {{{ proto string domxml_version() + Dumps document into string */ +PHP_FUNCTION(domxml_version) +{ + + RETURN_STRING(LIBXML_DOTTED_VERSION, 1); +} +/* }}} */ #endif /* HAVE_DOMXML */ /* Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.24 php4/ext/domxml/php_domxml.h:1.25 --- php4/ext/domxml/php_domxml.h:1.24 Tue Mar 20 21:45:40 2001 +++ php4/ext/domxml/php_domxml.hMon Apr 9 04:53:06 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.h,v 1.24 2001/03/21 05:45:40 steinm Exp $ */ +/* $Id: php_domxml.h,v 1.25 2001/04/09 11:53:06 steinm Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -37,6 +37,7 @@ extern PHP_MINIT_FUNCTION(domxml); extern PHP_RINIT_FUNCTION(domxml); extern PHP_MINFO_FUNCTION(domxml); +PHP_FUNCTION(domxml_version); PHP_FUNCTION(xmldoc); PHP_FUNCTION(xmldocfile); PHP_FUNCTION(xmltree); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 / NEWS
steinm Tue Jan 30 22:13:08 2001 EDT Modified files: /php4 NEWS Log: - note about change of pdf api Index: php4/NEWS diff -u php4/NEWS:1.573 php4/NEWS:1.574 --- php4/NEWS:1.573 Tue Jan 30 18:09:11 2001 +++ php4/NEWS Tue Jan 30 22:13:08 2001 @@ -2,6 +2,9 @@ ||| ?? ??? 200?, Version 4.0.5 +- Major change of the php pdf api. It could break some functions though + backwards compatibility was tried to maintain. Adding some still + missing functions as well. (Uwe) - mnoGoSearch extension module initial version has been added. This module currently at the alpha state, but it can be used already. - Allow url encoding in DB usernames and passwords (Stig, PEAR) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
steinm Wed Jan 31 23:07:09 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: some modification from Rainer Schaaf * fixed prototype for pdf_new() * MINFO: included Revision of pdf.c, removed info about CJK + in-memory, this is standard with V3.x) * repaired PDF_open_CCITT * repaired PDF_setfont * eliminated many compiler warnings. * former resource "pdf document" is now called "pdf object" Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.68 php4/ext/pdf/pdf.c:1.69 --- php4/ext/pdf/pdf.c:1.68 Wed Jan 31 09:00:10 2001 +++ php4/ext/pdf/pdf.c Wed Jan 31 23:07:09 2001 @@ -13,10 +13,11 @@ | [EMAIL PROTECTED] so we can mail you a copy immediately. | +------+ | Authors: Uwe Steinmann <[EMAIL PROTECTED]> | + | Rainer Schaaf <[EMAIL PROTECTED]> | +--+ */ -/* $Id: pdf.c,v 1.68 2001/01/31 17:00:10 dbeu Exp $ */ +/* $Id: pdf.c,v 1.69 2001/02/01 07:07:09 steinm Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -274,15 +275,14 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "CJK Font Support", "yes" ); - php_info_print_table_row(2, "In-memory PDF Creation Support", "yes" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.69 $" ); php_info_print_table_end(); } PHP_MINIT_FUNCTION(pdf) { - le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf document", module_number); + le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf object", +module_number); /* this does something like setlocale("C", ...) in PDFlib 3.x */ PDF_boot(); @@ -305,7 +305,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); PDF_set_info(pdf, field, Z_STRVAL_PP(arg2)); @@ -324,7 +324,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); convert_to_string_ex(arg3); @@ -393,7 +393,6 @@ } pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL); - PDF_set_parameter(pdf, "imagewarning", "true"); if(fp) { if (PDF_open_fp(pdf, fp) < 0) RETURN_FALSE; @@ -401,6 +400,8 @@ PDF_open_mem(pdf, pdf_flushwrite); } + PDF_set_parameter(pdf, "imagewarning", "true"); + ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf); } @@ -417,7 +418,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); PDF_close(pdf); @@ -437,7 +438,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); convert_to_double_ex(arg3); @@ -457,7 +458,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); PDF_end_page(pdf); RETURN_TRUE; @@ -475,7 +476,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); PDF_show(pdf, Z_STRVAL_PP(arg2)); @@ -494,7 +495,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf document", le_pdf); + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); convert_to_double_ex(arg3); @@ -518,7 +519,7 @@ WRONG_PARAM_COUNT; } - ZEND_FETCH_RESOURCE(pdf, PDF *
[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h
steinm Thu Feb 8 07:12:16 2001 EDT Modified files: /php4/ext/domxmlphp_domxml.c php_domxml.h Log: - add domxml_unlink_node(), not tested Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.26 php4/ext/domxml/php_domxml.c:1.27 --- php4/ext/domxml/php_domxml.c:1.26 Fri Jan 26 00:15:57 2001 +++ php4/ext/domxml/php_domxml.cThu Feb 8 07:12:16 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.c,v 1.26 2001/01/26 08:15:57 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.27 2001/02/08 15:12:16 steinm Exp $ */ #include "php.h" @@ -69,6 +69,7 @@ PHP_FE(domxml_children, NULL) PHP_FE(domxml_new_child,NULL) PHP_FE(domxml_node, NULL) + PHP_FE(domxml_unlink_node, NULL) PHP_FE(domxml_set_content, NULL) PHP_FE(domxml_new_xmldoc, NULL) PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL) @@ -115,12 +116,15 @@ PHP_FALIAS(set_attribute, domxml_set_attribute, NULL) PHP_FALIAS(attributes, domxml_attributes, NULL) PHP_FALIAS(node,domxml_node,NULL) + PHP_FALIAS(unlink, domxml_unlink_node, NULL) PHP_FALIAS(set_content, domxml_set_content, NULL) {NULL, NULL, NULL} }; #if defined(LIBXML_XPATH_ENABLED) static zend_function_entry php_xpathctx_class_functions[] = { + PHP_FALIAS(xpath_eval, xpath_eval, NULL) + PHP_FALIAS(xpath_eval_expression, xpath_eval_expression, NULL) {NULL, NULL, NULL} }; @@ -699,6 +703,40 @@ zend_hash_next_index_insert(return_value->value.ht, &child, sizeof(zval *), NULL); last = last->next; } +} +/* }}} */ + +/* {{{ proto object domxml_unlink_node([int node]) + Deletes node */ +PHP_FUNCTION(domxml_unlink_node) +{ + zval *id, **tmp; + xmlNode *nodep, *last; + int ret; + + if (ZEND_NUM_ARGS() == 0) { + id = getThis(); + if (id) { + if (zend_hash_find(id->value.obj.properties, "node", +sizeof("node"), (void **)&tmp) == FAILURE) { + php_error(E_WARNING, "unable to find my handle +property"); + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(nodep,xmlNodePtr,tmp,-1, "DomNode", +le_domxmlnodep) + } else { + RETURN_FALSE; + } + } else if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &id) == FAILURE) { + WRONG_PARAM_COUNT; + } else { + if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), +(void **)&tmp) == FAILURE) { + php_error(E_WARNING, "unable to find my handle property"); + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(nodep,xmlNodePtr,tmp,-1, "DomNode", le_domxmlnodep) + } + + xmlUnlinkNode(nodep); + RETURN_TRUE; } /* }}} */ Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.20 php4/ext/domxml/php_domxml.h:1.21 --- php4/ext/domxml/php_domxml.h:1.20 Fri Jan 26 00:15:57 2001 +++ php4/ext/domxml/php_domxml.hThu Feb 8 07:12:16 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_domxml.h,v 1.20 2001/01/26 08:15:57 steinm Exp $ */ +/* $Id: php_domxml.h,v 1.21 2001/02/08 15:12:16 steinm Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -55,6 +55,7 @@ PHP_FUNCTION(domxml_last_child); PHP_FUNCTION(domxml_parent); PHP_FUNCTION(domxml_node); +PHP_FUNCTION(domxml_unlink_node); PHP_FUNCTION(domxml_new_child); PHP_FUNCTION(domxml_set_content); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]