/* {{{ proto string qqwry(string qqwry_path) */ PHP_METHOD(qqwry,__construct) { char *qqwry_path = NULL; int qqwry_len; zval * _this_zval = NULL; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC,getThis(), "Os",&_this_zval,qqwry_class_entry_ptr, &qqwry_path,&qqwry_len) == FAILURE) { return; } add_property_string(_this_zval,"f",qqwry_path,1); }
/* {{{ proto bool datefmt_set_calendar(IntlDateFormatter $mf, mixed $calendar) * Set formatter's calendar. */ U_CFUNC PHP_FUNCTION(datefmt_set_calendar) { zval *calendar_zv; DATE_FORMAT_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz", &object, IntlDateFormatter_ce_ptr, &calendar_zv) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_calendar: unable to parse input params", 0 TSRMLS_CC); RETURN_FALSE; } DATE_FORMAT_METHOD_FETCH_OBJECT; Calendar *cal; long cal_type; bool cal_owned; Locale locale = Locale::createFromName(dfo->requested_locale); // getting the actual locale from the DateFormat is not enough // because we would have lost modifiers such as @calendar. We // must store the requested locale on object creation if (datefmt_process_calendar_arg(calendar_zv, locale, "datefmt_set_calendar", INTL_DATA_ERROR_P(dfo), cal, cal_type, cal_owned TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (cal_owned) { /* a non IntlCalendar was specified, we want to keep the timezone */ TimeZone *old_timezone = fetch_datefmt(dfo)->getTimeZone().clone(); if (old_timezone == NULL) { intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, "datefmt_set_calendar: Out of memory when cloning calendar", 0 TSRMLS_CC); delete cal; RETURN_FALSE; } cal->adoptTimeZone(old_timezone); } else { cal = cal->clone(); if (cal == NULL) { intl_errors_set(INTL_DATA_ERROR_P(dfo), U_MEMORY_ALLOCATION_ERROR, "datefmt_set_calendar: Out of memory when cloning calendar", 0 TSRMLS_CC); RETURN_FALSE; } } fetch_datefmt(dfo)->adoptCalendar(cal); dfo->calendar = cal_type; RETURN_TRUE; }
/* {{{ proto mixed tidy_getopt(string option) Returns the value of the specified configuration option for the tidy document. */ static PHP_FUNCTION(tidy_getopt) { PHPTidyObj *obj; char *optname; void *optval; size_t optname_len; TidyOption opt; TidyOptionType optt; TIDY_SET_CONTEXT; if (object) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &optname, &optname_len) == FAILURE) { RETURN_FALSE; } } else { if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) { RETURN_FALSE; } } obj = Z_TIDY_P(object); opt = tidyGetOptionByName(obj->ptdoc->doc, optname); if (!opt) { php_error_docref(NULL, E_WARNING, "Unknown Tidy Configuration Option '%s'", optname); RETURN_FALSE; } optval = php_tidy_get_opt_val(obj->ptdoc, opt, &optt); switch (optt) { case TidyString: RETVAL_STR((zend_string*)optval); return; case TidyInteger: RETURN_LONG((zend_long)optval); break; case TidyBoolean: if (optval) { RETURN_TRUE; } else { RETURN_FALSE; } break; default: php_error_docref(NULL, E_WARNING, "Unable to determine type of configuration option"); break; } RETURN_FALSE; }
/* {{{ proto Closure Closure::bind(callable old, object to [, mixed scope]) Create a closure from another one and bind to another object and scope */ ZEND_METHOD(Closure, bind) { zval *newthis, *zclosure, *scope_arg = NULL; zend_closure *closure, *new_closure; zend_class_entry *ce, *called_scope; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) { return; } closure = (zend_closure *)Z_OBJ_P(zclosure); if (scope_arg != NULL) { /* scope argument was given */ if (Z_TYPE_P(scope_arg) == IS_OBJECT) { ce = Z_OBJCE_P(scope_arg); } else if (Z_TYPE_P(scope_arg) == IS_NULL) { ce = NULL; } else { zend_string *class_name = zval_get_string(scope_arg); if (zend_string_equals_literal(class_name, "static")) { ce = closure->func.common.scope; } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) { zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name)); zend_string_release(class_name); RETURN_NULL(); } zend_string_release(class_name); } } else { /* scope argument not given; do not change the scope by default */ ce = closure->func.common.scope; } if (!zend_valid_closure_binding(closure, newthis, ce)) { return; } if (newthis) { called_scope = Z_OBJCE_P(newthis); } else { called_scope = ce; } zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); new_closure = (zend_closure *) Z_OBJ_P(return_value); /* Runtime cache relies on bound scope to be immutable, hence we need a separate rt cache in case scope changed */ if (ZEND_USER_CODE(closure->func.type) && (closure->func.common.scope != new_closure->func.common.scope || (closure->func.op_array.fn_flags & ZEND_ACC_NO_RT_ARENA))) { new_closure->func.op_array.run_time_cache = emalloc(new_closure->func.op_array.cache_size); memset(new_closure->func.op_array.run_time_cache, 0, new_closure->func.op_array.cache_size); new_closure->func.op_array.fn_flags |= ZEND_ACC_NO_RT_ARENA; } }
/* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] ) Create a closure from another one and bind to another object and scope */ ZEND_METHOD(Closure, bind) { zval *newthis, *zclosure, *scope_arg = NULL; zend_closure *closure; zend_class_entry *ce, *called_scope; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) { RETURN_NULL(); } closure = (zend_closure *)Z_OBJ_P(zclosure); if ((newthis != NULL) && (closure->func.common.fn_flags & ZEND_ACC_STATIC)) { zend_error(E_WARNING, "Cannot bind an instance to a static closure"); } if (scope_arg != NULL) { /* scope argument was given */ if (Z_TYPE_P(scope_arg) == IS_OBJECT) { ce = Z_OBJCE_P(scope_arg); } else if (Z_TYPE_P(scope_arg) == IS_NULL) { ce = NULL; } else { zend_string *class_name = zval_get_string(scope_arg); if (zend_string_equals_literal(class_name, "static")) { ce = closure->func.common.scope; } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) { zend_error(E_WARNING, "Class '%s' not found", class_name->val); zend_string_release(class_name); RETURN_NULL(); } zend_string_release(class_name); } if(ce && ce != closure->func.common.scope && ce->type == ZEND_INTERNAL_CLASS) { /* rebinding to internal class is not allowed */ zend_error(E_WARNING, "Cannot bind closure to scope of internal class %s", ce->name->val); return; } } else { /* scope argument not given; do not change the scope by default */ ce = closure->func.common.scope; } if (newthis) { called_scope = Z_OBJCE_P(newthis); } else { called_scope = ce; } zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); }
U_CFUNC PHP_FUNCTION(intltz_use_daylight_time) { TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_use_daylight_time: bad arguments", 0); RETURN_FALSE; } TIMEZONE_METHOD_FETCH_OBJECT; RETURN_BOOL(to->utimezone->useDaylightTime()); }
U_CFUNC PHP_FUNCTION(intltz_get_raw_offset) { TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_raw_offset: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } TIMEZONE_METHOD_FETCH_OBJECT; RETURN_LONG(to->utimezone->getRawOffset()); }
U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, GregorianCalendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlgregcal_get_gregorian_change: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; RETURN_DOUBLE((double)fetch_greg(co)->getGregorianChange()); }
U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; RETURN_LONG(co->ucal->getSkippedWallTimeOption()); }
U_CFUNC PHP_FUNCTION(intlcal_is_lenient) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_is_lenient: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; RETURN_BOOL((int)co->ucal->isLenient()); }
U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) { TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, TimeZone_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_dst_savings: bad arguments", 0); RETURN_FALSE; } TIMEZONE_METHOD_FETCH_OBJECT; RETURN_LONG((zend_long)to->utimezone->getDSTSavings()); }
/* {{{ constructor, create one new instance like this: * $client = new McpackHessianClient('http://xxxx', array('xxx' => 'xxx')), * method's declaration is McpackHessianClient($strUrl, $arrOptions). **/ PHP_METHOD(McpackHessianClient, __construct) { zend_class_entry *ce; zval *url, *options, *p_this; MAKE_STD_ZVAL(options); array_init(options); p_this = getThis(); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, p_this, "Oz|z", &ce, mcphessian_ce_ptr, &url, &options) == FAILURE) { return; } // set the properties of instance zend_update_property(mcphessian_ce_ptr, p_this, ZEND_STRL("url"), url TSRMLS_CC); zend_update_property(mcphessian_ce_ptr, p_this, ZEND_STRL("options"), options TSRMLS_CC); }
U_CFUNC PHP_FUNCTION(intltz_get_display_name) { zend_bool daylight = 0; zend_long display_type = TimeZone::LONG; const char *locale_str = NULL; size_t dummy = 0; TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type, &locale_str, &dummy) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_display_name: bad arguments", 0); RETURN_FALSE; } bool found = false; for (int i = 0; !found && i < sizeof(display_types)/sizeof(*display_types); i++) { if (display_types[i] == display_type) found = true; } if (!found) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_display_name: wrong display type", 0); RETURN_FALSE; } if (!locale_str) { locale_str = intl_locale_get_default(); } TIMEZONE_METHOD_FETCH_OBJECT; UnicodeString result; to->utimezone->getDisplayName((UBool)daylight, (TimeZone::EDisplayType)display_type, Locale::createFromName(locale_str), result); char *str; int str_len; intl_convert_utf16_to_utf8(&str, &str_len, result.getBuffer(), result.length(), TIMEZONE_ERROR_CODE_P(to)); INTL_METHOD_CHECK_STATUS(to, "intltz_get_display_name: " "could not convert resulting time zone id to UTF-16"); RETVAL_STRINGL(str, str_len); //???? efree(str); }
PHP_METHOD(pdo_connect_pool_PDOStatement, __call) { zval *z_args; zval *object; zval *pass_data; zval **zres, **source_zval; char *cmd; int cmd_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osa", &object, pdo_connect_pool_PDOStatement_class_entry_ptr, &cmd, &cmd_len, &z_args) == FAILURE) { RETURN_FALSE; } cpClient *cli; if (zend_hash_find(Z_OBJPROP_P(getThis()), ZEND_STRS("cli"), (void **) &zres) == SUCCESS) { ZEND_FETCH_RESOURCE(cli, cpClient*, zres, -1, CP_RES_CLIENT_NAME, le_cli_connect_pool); } else {
/* {{{ proto void DOMXPath::__construct(DOMDocument doc) U */ PHP_METHOD(domxpath, __construct) { zval *id, *doc; xmlDocPtr docp = NULL; dom_object *docobj; dom_xpath_object *intern; xmlXPathContextPtr ctx, oldctx; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_xpath_class_entry, &doc, dom_document_class_entry) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } zend_restore_error_handling(&error_handling TSRMLS_CC); DOM_GET_OBJ(docp, doc, xmlDocPtr, docobj); ctx = xmlXPathNewContext(docp); if (ctx == NULL) { php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC); RETURN_FALSE; } intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern != NULL) { oldctx = (xmlXPathContextPtr)intern->ptr; if (oldctx != NULL) { php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC); xmlXPathFreeContext(oldctx); } xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "functionString", (const xmlChar *) "http://php.net/xpath", dom_xpath_ext_function_string_php); xmlXPathRegisterFuncNS (ctx, (const xmlChar *) "function", (const xmlChar *) "http://php.net/xpath", dom_xpath_ext_function_object_php); intern->ptr = ctx; ctx->userData = (void *)intern; intern->document = docobj->document; php_libxml_increment_doc_ref((php_libxml_node_object *)intern, docp TSRMLS_CC); } }
/* {{{ proto boolean XMLReader::expand() Moves the position of the current instance to the next node in the stream. */ PHP_METHOD(xmlreader, expand) { #ifdef HAVE_DOM zval *id, *basenode = NULL; int ret; xmlreader_object *intern; xmlNode *node, *nodec; xmlDocPtr docp = NULL; php_libxml_node_object *domobj = NULL; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|O!", &id, xmlreader_class_entry, &basenode, dom_node_class_entry) == FAILURE) { return; } if (basenode != NULL) { NODE_GET_OBJ(node, basenode, xmlNodePtr, domobj); docp = node->doc; } intern = Z_XMLREADER_P(id); if (intern && intern->ptr) { node = xmlTextReaderExpand(intern->ptr); if (node == NULL) { php_error_docref(NULL, E_WARNING, "An Error Occurred while expanding "); RETURN_FALSE; } else { nodec = xmlDocCopyNode(node, docp, 1); if (nodec == NULL) { php_error_docref(NULL, E_NOTICE, "Cannot expand this node type"); RETURN_FALSE; } else { DOM_RET_OBJ(nodec, &ret, (dom_object *)domobj); } } } else { php_error_docref(NULL, E_WARNING, "Load Data before trying to expand"); RETURN_FALSE; } #else php_error(E_WARNING, "DOM support is not enabled"); return; #endif }
/* {{{ proto Closure Closure::bind(callable old, object to [, mixed scope]) Create a closure from another one and bind to another object and scope */ ZEND_METHOD(Closure, bind) { zval *newthis, *zclosure, *scope_arg = NULL; zend_closure *closure; zend_class_entry *ce, *called_scope; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) { return; } closure = (zend_closure *)Z_OBJ_P(zclosure); if (scope_arg != NULL) { /* scope argument was given */ if (Z_TYPE_P(scope_arg) == IS_OBJECT) { ce = Z_OBJCE_P(scope_arg); } else if (Z_TYPE_P(scope_arg) == IS_NULL) { ce = NULL; } else { zend_string *tmp_class_name; zend_string *class_name = zval_get_tmp_string(scope_arg, &tmp_class_name); if (zend_string_equals_literal(class_name, "static")) { ce = closure->func.common.scope; } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) { zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name)); zend_string_release_ex(class_name, 0); RETURN_NULL(); } zend_tmp_string_release(tmp_class_name); } } else { /* scope argument not given; do not change the scope by default */ ce = closure->func.common.scope; } if (!zend_valid_closure_binding(closure, newthis, ce)) { return; } if (newthis) { called_scope = Z_OBJCE_P(newthis); } else { called_scope = ce; } zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); }
U_CFUNC PHP_FUNCTION(intlcal_set_lenient) { zend_bool is_lenient; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &object, Calendar_ce_ptr, &is_lenient) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_lenient: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; co->ucal->setLenient((UBool) is_lenient); RETURN_TRUE; }
U_CFUNC PHP_FUNCTION(intlcal_get_error_code) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_error_code: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } /* Fetch the object (without resetting its last error code ). */ co = Z_INTL_CALENDAR_P(object); if (co == NULL) RETURN_FALSE; RETURN_LONG((zend_long)CALENDAR_ERROR_CODE(co)); }
/* {{{ proto bool MarkdownDocument::initFromStream(mixed $markdown_stream [, int $flags = 0]) * Initializes a markdown document from a stream. */ PHP_METHOD(markdowndoc, initFromStream) { zval *this, *zstream; long flags = 0; int ret; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|l", &this, markdowndoc_ce, &zstream, &flags) == FAILURE) { RETURN_FALSE; } ret = markdown_init_from_stream(this, zstream, flags TSRMLS_CC); if (ret == FAILURE) { RETURN_FALSE; /* no rollback needed */ } RETURN_TRUE; }
U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_in_daylight_time: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; UBool ret = co->ucal->inDaylightTime(CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "intlcal_in_daylight_time: " "Error calling ICU method"); RETURN_BOOL((int)ret); }
U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; uint8_t result = co->ucal->getMinimalDaysInFirstWeek(); INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); RETURN_LONG((zend_long)result); }
U_CFUNC PHP_FUNCTION(intlcal_set_time) { double time_arg; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Od", &object, Calendar_ce_ptr, &time_arg) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_time: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; co->ucal->setTime((UDate)time_arg, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "Call to underlying method failed"); RETURN_TRUE; }
U_CFUNC PHP_FUNCTION(intlcal_get_time) { CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, Calendar_ce_ptr) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_time: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; UDate result = co->ucal->getTime(CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "intlcal_get_time: error calling ICU Calendar::getTime"); RETURN_DOUBLE((double)result); }
/* {{{ proto int datefmt_get_calendar(IntlDateFormatter $mf) * Get formatter calendar type. */ U_CFUNC PHP_FUNCTION(datefmt_get_calendar) { DATE_FORMAT_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_calendar: unable to parse input params", 0 TSRMLS_CC); RETURN_FALSE; } DATE_FORMAT_METHOD_FETCH_OBJECT; if (dfo->calendar == -1) { /* an IntlCalendar was provided to the constructor */ RETURN_FALSE; } RETURN_LONG(dfo->calendar); }
U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change) { double date; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Od", &object, GregorianCalendar_ce_ptr, &date) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlgregcal_set_gregorian_change: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; fetch_greg(co)->setGregorianChange(date, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "intlgregcal_set_gregorian_change: error " "calling ICU method"); RETURN_TRUE; }
/* {{{ proto bool MarkdownDocument::initFromString(string $markdown_string [, int $flags = 0]) * Initializes a markdown document from a string. */ PHP_METHOD(markdowndoc, initFromString) { zval *this; char *string; int string_len; long flags = 0; int ret; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &this, markdowndoc_ce, &string, &string_len, &flags) == FAILURE) { RETURN_FALSE; } ret = markdown_init_from_string(this, string, string_len, flags TSRMLS_CC); if (ret == FAILURE) { RETURN_FALSE; /* no rollback needed */ } RETURN_TRUE; }
/* {{{ proto void DOMAttr::__construct(string name, [string value]); */ PHP_METHOD(domattr, __construct) { zval *id; xmlAttrPtr nodep = NULL; xmlNodePtr oldnode = NULL; dom_object *intern; char *name, *value = NULL; int name_len, value_len, name_valid; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } zend_restore_error_handling(&error_handling TSRMLS_CC); intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); name_valid = xmlValidateName((xmlChar *) name, 0); if (name_valid != 0) { php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC); RETURN_FALSE; } nodep = xmlNewProp(NULL, (xmlChar *) name, value); if (!nodep) { php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC); RETURN_FALSE; } if (intern != NULL) { oldnode = dom_object_get_node(intern); if (oldnode != NULL) { php_libxml_node_free_resource(oldnode TSRMLS_CC); } php_libxml_increment_node_ptr((php_libxml_node_object *)intern, (xmlNodePtr)nodep, (void *)intern TSRMLS_CC); } }
/* {{{ proto string datefmt_get_timezone_id(IntlDateFormatter $mf) * Get formatter timezone_id. */ U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id) { DATE_FORMAT_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timezone_" "id: unable to parse input params", 0 TSRMLS_CC); RETURN_FALSE; } DATE_FORMAT_METHOD_FETCH_OBJECT; UnicodeString res = UnicodeString(); fetch_datefmt(dfo)->getTimeZone().getID(res); intl_charFromString(res, &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS(dfo, "Could not convert time zone id to UTF-8"); Z_TYPE_P(return_value) = IS_STRING; }
/* {{{ proto void DOMEntityReference::__construct(string name); */ PHP_METHOD(domentityreference, __construct) { zval *id; xmlNode *node; xmlNodePtr oldnode = NULL; dom_object *intern; char *name; size_t name_len, name_valid; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling); if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) { zend_restore_error_handling(&error_handling); return; } zend_restore_error_handling(&error_handling); name_valid = xmlValidateName((xmlChar *) name, 0); if (name_valid != 0) { php_dom_throw_error(INVALID_CHARACTER_ERR, 1); RETURN_FALSE; } node = xmlNewReference(NULL, (xmlChar *) name); if (!node) { php_dom_throw_error(INVALID_STATE_ERR, 1); RETURN_FALSE; } intern = Z_DOMOBJ_P(id); if (intern != NULL) { oldnode = dom_object_get_node(intern); if (oldnode != NULL) { php_libxml_node_free_resource(oldnode ); } php_libxml_increment_node_ptr((php_libxml_node_object *)intern, node, (void *)intern); } }