本文整理汇总了C++中phalcon_is_iterable函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_is_iterable函数的具体用法?C++ phalcon_is_iterable怎么用?C++ phalcon_is_iterable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phalcon_is_iterable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Returns the paths using positions as keys and names as values
*
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths){
zval *paths, *position = NULL, *path = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(paths);
phalcon_read_property_this(&paths, this_ptr, SL("_paths"), PH_NOISY TSRMLS_CC);
phalcon_is_iterable(paths, &ah0, &hp0, 0, 0);
array_init_size(return_value, zend_hash_num_elements(ah0));
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(path, ah0, hp0);
PHALCON_GET_HVALUE(position);
phalcon_array_update_zval(&return_value, position, path, PH_COPY);
zend_hash_move_forward_ex(ah0, &hp0);
}
RETURN_MM();
}
开发者ID:100851766,项目名称:cphalcon,代码行数:33,代码来源:route.c
示例2: PHP_METHOD
/**
* Removes an access from a resource
*
* @param string $resourceName
* @param mixed $accessList
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, dropResourceAccess){
zval *resource_name, *access_list, *access_name = NULL;
zval *access_key = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &resource_name, &access_list);
if (Z_TYPE_P(access_list) == IS_ARRAY) {
phalcon_is_iterable(access_list, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(access_name);
PHALCON_INIT_NVAR(access_key);
PHALCON_CONCAT_VSV(access_key, resource_name, "!", access_name);
phalcon_unset_property_array(this_ptr, SL("_accessList"), access_key TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
}
} else {
PHALCON_INIT_NVAR(access_key);
PHALCON_CONCAT_VSV(access_key, resource_name, "!", access_name);
phalcon_unset_property_array(this_ptr, SL("_accessList"), access_key TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
开发者ID:Diego-Brocanelli,项目名称:cphalcon,代码行数:41,代码来源:memory.c
示例3: PHP_METHOD
/**
* Phalcon\Translate\Adapter\Gettext constructor
*
* @param array $options
* @throws \Phalcon\Translate\Exception
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, __construct){
zval *options, *locale, *default_domain, *directory, *setting, *key = NULL, *value = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &options);
if (Z_TYPE_P(options) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Invalid options");
return;
}
if (!phalcon_array_isset_string_fetch(&locale, options, SS("locale"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Parameter \"locale\" is required");
return;
}
if (!phalcon_array_isset_string_fetch(&default_domain, options, SS("defaultDomain"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Parameter \"defaultDomain\" is required");
return;
}
if (!phalcon_array_isset_string_fetch(&directory, options, SS("directory"))) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_translate_exception_ce, "Parameter \"directory\" is required");
return;
}
phalcon_update_property_this(this_ptr, SL("_locale"), locale TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_defaultDomain"), default_domain TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_directory"), directory TSRMLS_CC);
PHALCON_INIT_VAR(setting);
PHALCON_CONCAT_SV(setting, "LC_ALL=", locale);
PHALCON_CALL_FUNCTION(NULL, "putenv", setting);
setlocale(LC_ALL, Z_STRVAL_P(locale));
if (Z_TYPE_P(directory) == IS_ARRAY) {
phalcon_is_iterable(directory, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(key, ah0, hp0);
PHALCON_GET_HVALUE(value);
bindtextdomain(Z_STRVAL_P(key), Z_STRVAL_P(value));
zend_hash_move_forward_ex(ah0, &hp0);
}
} else {
bindtextdomain(Z_STRVAL_P(default_domain), Z_STRVAL_P(directory));
}
textdomain(Z_STRVAL_P(default_domain));
PHALCON_MM_RESTORE();
}
开发者ID:9466,项目名称:cphalcon,代码行数:66,代码来源:gettext.c
示例4: PHP_METHOD
/**
* Returns an HTML string of debugging information about any number of
* variables, each wrapped in a "pre" tag.
*
* <code>
* $foo = "string";
* $bar = ["key" => "value"];
* $baz = new stdClass();
* echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
*</code>
*
* @param mixed variable
* @param ...
*/
PHP_METHOD(Phalcon_Debug_Dump, variables){
zval *arg_list = NULL, *name = NULL, *variable = NULL, *output = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
PHALCON_CALL_FUNCTION(&arg_list, "func_get_args");
phalcon_is_iterable(arg_list, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(name, ah0, hp0);
PHALCON_GET_HVALUE(variable);
PHALCON_CALL_SELF(&output, "variable", variable);
PHALCON_SCONCAT(return_value, output);
zend_hash_move_forward_ex(ah0, &hp0);
}
RETURN_MM();
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:40,代码来源:dump.c
示例5: PHP_METHOD
/**
* Sends a message to each registered logger
*
* @param string $message
* @param int $type
*/
PHP_METHOD(Phalcon_Logger_Multiple, log){
zval *message, *type = NULL, *loggers, *logger = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &message, &type);
if (!type) {
PHALCON_INIT_VAR(type);
ZVAL_LONG(type, 7);
}
PHALCON_OBS_VAR(loggers);
phalcon_read_property_this(&loggers, this_ptr, SL("_loggers"), PH_NOISY_CC);
if (Z_TYPE_P(loggers) == IS_ARRAY) {
phalcon_is_iterable(loggers, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(logger);
phalcon_call_method_p2_noret(logger, "log", message, type);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
PHALCON_MM_RESTORE();
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:41,代码来源:multiple.c
示例6: PHP_METHOD
/**
* Remove all the transactions from the manager
*
*/
PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, collectTransactions){
zval *transactions, *managed_transaction = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(transactions);
phalcon_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC);
if (phalcon_fast_count_ev(transactions TSRMLS_CC)) {
phalcon_is_iterable(transactions, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(managed_transaction);
phalcon_property_decr(this_ptr, SL("_number") TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
}
phalcon_update_property_null(this_ptr, SL("_transactions") TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:33,代码来源:manager.c
示例7: PHP_METHOD
/**
* Deny access to a role on a resource
*
* You can use '*' as wildcard
*
* Example:
* <code>
* //Deny access to guests to search on customers
* $acl->deny('guests', 'customers', 'search');
*
* //Deny access to guests to search or create on customers
* $acl->deny('guests', 'customers', array('search', 'create'));
*
* //Deny access to any role to browse on products
* $acl->deny('*', 'products', 'browse');
*
* //Deny access to any role to browse on any resource
* $acl->deny('*', '*', 'browse');
* </code>
*
* @param string $roleName
* @param string $resourceName
* @param mixed $access
* @return boolean
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, deny){
zval *role_name, *resource_name, *access, *action, *roles_names;
zval *key = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 3, 0, &role_name, &resource_name, &access);
PHALCON_INIT_VAR(action);
ZVAL_LONG(action, 0);
if (!PHALCON_IS_STRING(role_name, "*")) {
PHALCON_RETURN_CALL_METHOD(this_ptr, "_allowordeny", role_name, resource_name, access, action);
} else {
PHALCON_OBS_VAR(roles_names);
phalcon_read_property_this(&roles_names, this_ptr, SL("_rolesNames"), PH_NOISY TSRMLS_CC);
phalcon_is_iterable(roles_names, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(key, ah0, hp0);
PHALCON_CALL_METHOD(NULL, this_ptr, "_allowordeny", key, resource_name, access, action);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
RETURN_MM();
}
开发者ID:CoolCloud,项目名称:cphalcon,代码行数:57,代码来源:memory.c
示例8: PHP_METHOD
/**
* Returns the paths using positions as keys and names as values
*
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths){
zval *reversed, *paths, *position = NULL, *path = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(reversed);
array_init(reversed);
PHALCON_OBS_VAR(paths);
phalcon_read_property_this(&paths, this_ptr, SL("_paths"), PH_NOISY_CC);
phalcon_is_iterable(paths, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(path, ah0, hp0);
PHALCON_GET_HVALUE(position);
phalcon_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE);
zend_hash_move_forward_ex(ah0, &hp0);
}
RETURN_CTOR(reversed);
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:34,代码来源:route.c
示例9: PHP_METHOD
/**
* Restore a Phalcon\Http\Response\Headers object
*
* @param array $data
* @return Phalcon\Http\Response\Headers
*/
PHP_METHOD(Phalcon_Http_Response_Headers, __set_state){
zval *data, *headers, *data_headers, *value = NULL, *key = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &data);
PHALCON_INIT_VAR(headers);
object_init_ex(headers, phalcon_http_response_headers_ce);
if (phalcon_array_isset_string(data, SS("_headers"))) {
PHALCON_OBS_VAR(data_headers);
phalcon_array_fetch_string(&data_headers, data, SL("_headers"), PH_NOISY);
phalcon_is_iterable(data_headers, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(key, ah0, hp0);
PHALCON_GET_HVALUE(value);
phalcon_call_method_p2_noret(headers, "set", key, value);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
RETURN_CTOR(headers);
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:40,代码来源:headers.c
示例10: PHP_METHOD
/**
* Prints the messages in the session flasher
*
* @param string $type
* @param boolean $remove
*/
PHP_METHOD(Phalcon_Flash_Session, output){
zval *remove = NULL, *messages = NULL, *message = NULL, *type = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &remove);
if (!remove) {
remove = PHALCON_GLOBAL(z_true);
}
PHALCON_CALL_METHOD(&messages, this_ptr, "_getsessionmessages", remove);
if (Z_TYPE_P(messages) == IS_ARRAY) {
phalcon_is_iterable(messages, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(type, ah0, hp0);
PHALCON_GET_HVALUE(message);
PHALCON_CALL_METHOD(NULL, this_ptr, "outputmessage", type, message);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
PHALCON_MM_RESTORE();
}
开发者ID:100851766,项目名称:cphalcon,代码行数:40,代码来源:session.c
示例11: PHP_METHOD
/**
* Gets a list of columns with escaped identifiers
*
*<code>
* echo $dialect->getColumnList(array('column1', 'column'));
*</code>
*
* @param array $columnList
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect, getColumnList){
zval *column_list, *str_list, *escape_char, *column = NULL;
zval *column_quoted = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &column_list);
PHALCON_INIT_VAR(str_list);
array_init(str_list);
PHALCON_OBS_VAR(escape_char);
phalcon_read_property_this(&escape_char, this_ptr, SL("_escapeChar"), PH_NOISY_CC);
phalcon_is_iterable(column_list, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(column);
PHALCON_INIT_NVAR(column_quoted);
PHALCON_CONCAT_VVV(column_quoted, escape_char, column, escape_char);
phalcon_array_append(&str_list, column_quoted, PH_SEPARATE);
zend_hash_move_forward_ex(ah0, &hp0);
}
phalcon_fast_join_str(return_value, SL(", "), str_list TSRMLS_CC);
RETURN_MM();
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:44,代码来源:dialect.c
示例12: PHP_METHOD
/**
* Returns the annotations found in the properties' docblocks
*
* @return Phalcon\Annotations\Collection[]
*/
PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){
zval *annotations, *reflection_data, *reflection_properties;
zval *collections, *reflection_property = NULL, *property = NULL;
zval *collection = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(annotations);
phalcon_read_property(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC);
if (Z_TYPE_P(annotations) != IS_OBJECT) {
PHALCON_OBS_VAR(reflection_data);
phalcon_read_property(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string(reflection_data, SS("properties"))) {
PHALCON_OBS_VAR(reflection_properties);
phalcon_array_fetch_string(&reflection_properties, reflection_data, SL("properties"), PH_NOISY_CC);
if (phalcon_fast_count_ev(reflection_properties TSRMLS_CC)) {
PHALCON_INIT_VAR(collections);
array_init(collections);
if (!phalcon_is_iterable(reflection_properties, &ah0, &hp0, 0, 0 TSRMLS_CC)) {
return;
}
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_FOREACH_KEY(property, ah0, hp0);
PHALCON_GET_FOREACH_VALUE(reflection_property);
PHALCON_INIT_NVAR(collection);
object_init_ex(collection, phalcon_annotations_collection_ce);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(collection, "__construct", reflection_property);
phalcon_array_update_zval(&collections, property, &collection, PH_COPY | PH_SEPARATE TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
}
phalcon_update_property_zval(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC);
RETURN_CTOR(collections);
}
}
phalcon_update_property_bool(this_ptr, SL("_propertyAnnotations"), 0 TSRMLS_CC);
RETURN_MM_FALSE;
}
RETURN_CCTOR(annotations);
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:62,代码来源:reflection.c
示例13: PHP_METHOD
/**
* Renders a view using the template engine
*
* @param string $path
* @param array $params
* @param boolean $mustClean
*/
PHP_METHOD(Phalcon_Mvc_View_Engine_Php, render){
zval *path, *params, *must_clean = NULL, *value = NULL, *key = NULL, *contents;
zval *view;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z", &path, ¶ms, &must_clean) == FAILURE) {
RETURN_MM_NULL();
}
if (!must_clean) {
PHALCON_INIT_VAR(must_clean);
ZVAL_BOOL(must_clean, 0);
}
if (PHALCON_IS_TRUE(must_clean)) {
PHALCON_CALL_FUNC_NORETURN("ob_clean");
}
if (Z_TYPE_P(params) == IS_ARRAY) {
if (!phalcon_is_iterable(params, &ah0, &hp0, 0, 0 TSRMLS_CC)) {
return;
}
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_FOREACH_KEY(key, ah0, hp0);
PHALCON_GET_FOREACH_VALUE(value);
if (phalcon_set_symbol(key, value TSRMLS_CC) == FAILURE){
return;
}
zend_hash_move_forward_ex(ah0, &hp0);
}
}
if (phalcon_require(path TSRMLS_CC) == FAILURE) {
return;
}
if (PHALCON_IS_TRUE(must_clean)) {
PHALCON_INIT_VAR(contents);
PHALCON_CALL_FUNC(contents, "ob_get_contents");
PHALCON_OBS_VAR(view);
phalcon_read_property(&view, this_ptr, SL("_view"), PH_NOISY_CC);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(view, "setcontent", contents);
}
PHALCON_MM_RESTORE();
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:63,代码来源:php.c
示例14: PHP_METHOD
/**
* Returns the annotations found in a specific property
*
* @param string $className
* @param string $propertyName
* @return Phalcon\Annotations\Collection
*/
PHP_METHOD(Phalcon_Annotations_Adapter, getProperty){
zval *class_name, *property_name, *class_annotations;
zval *properties, *property = NULL, *name = NULL, *collection;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &class_name, &property_name);
/**
* Get the full annotations from the class
*/
PHALCON_INIT_VAR(class_annotations);
PHALCON_CALL_METHOD_PARAMS_1(class_annotations, this_ptr, "get", class_name);
/**
* A valid annotations reflection is an object
*/
if (Z_TYPE_P(class_annotations) == IS_OBJECT) {
PHALCON_INIT_VAR(properties);
PHALCON_CALL_METHOD(properties, class_annotations, "getpropertyannotations");
if (Z_TYPE_P(properties) == IS_ARRAY) {
if (!phalcon_is_iterable(properties, &ah0, &hp0, 0, 0 TSRMLS_CC)) {
return;
}
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_FOREACH_KEY(name, ah0, hp0);
PHALCON_GET_FOREACH_VALUE(property);
if (PHALCON_IS_EQUAL(name, property_name)) {
RETURN_CCTOR(property);
}
zend_hash_move_forward_ex(ah0, &hp0);
}
}
}
/**
* Returns a collection anyways
*/
PHALCON_INIT_VAR(collection);
object_init_ex(collection, phalcon_annotations_collection_ce);
PHALCON_CALL_METHOD_NORETURN(collection, "__construct");
RETURN_CTOR(collection);
}
开发者ID:101010111100,项目名称:cphalcon,代码行数:63,代码来源:adapter.c
示例15: PHP_METHOD
/**
* Concatenates strings using the separator only once without duplication in places concatenation
*
* <code>
* $str = Phalcon\Text::concat("/", "/tmp/", "/folder_1/", "/folder_2", "folder_3/");
* echo $str; // /tmp/folder_1/folder_2/folder_3/
* </code>
*
* @param string separator
* @param string a
* @param string b
* @param string ...N
*/
PHP_METHOD(Phalcon_Text, concat){
zval *separator, *a, *b;
zval *arg_num = NULL, *arg_list = NULL, *offset, *args = NULL;
zval *c = NULL, *a_trimmed = NULL, *b_trimmed = NULL, *c_trimmed = NULL, *tmp = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 3, 0, &separator, &a, &b);
PHALCON_CALL_FUNCTION(&arg_num, "func_num_args");
if (Z_LVAL_P(arg_num) > 3) {
PHALCON_CALL_FUNCTION(&arg_list, "func_get_args");
PHALCON_INIT_VAR(offset);
ZVAL_LONG(offset, 3);
PHALCON_CALL_FUNCTION(&args, "array_slice", arg_list, offset);
phalcon_is_iterable(args, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(c);
PHALCON_INIT_NVAR(b_trimmed);
phalcon_fast_trim(b_trimmed, b, separator, PHALCON_TRIM_RIGHT TSRMLS_CC);
PHALCON_INIT_NVAR(c_trimmed);
phalcon_fast_trim(c_trimmed, c, separator, PHALCON_TRIM_LEFT TSRMLS_CC);
PHALCON_INIT_NVAR(tmp);
PHALCON_CONCAT_VVV(tmp, b_trimmed, separator, c_trimmed)
PHALCON_CPY_WRT(b, tmp);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
PHALCON_INIT_NVAR(a_trimmed);
phalcon_fast_trim(a_trimmed, a, separator, PHALCON_TRIM_RIGHT TSRMLS_CC);
PHALCON_INIT_NVAR(b_trimmed);
phalcon_fast_trim(b_trimmed, b, separator, PHALCON_TRIM_LEFT TSRMLS_CC);
PHALCON_INIT_NVAR(tmp);
PHALCON_CONCAT_VVV(tmp, a_trimmed, separator, b_trimmed)
RETURN_CTOR(tmp);
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:68,代码来源:text.c
示例16: PHP_METHOD
/**
* Phalcon\Annotations\Annotation constructor
*
* @param array $reflectionData
*/
PHP_METHOD(Phalcon_Annotations_Annotation, __construct){
zval *reflection_data, *name = NULL, *arguments, *expr_arguments;
zval *argument = NULL, *expr = NULL, *resolved_argument = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &reflection_data);
if (Z_TYPE_P(reflection_data) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "Reflection data must be an array");
return;
}
PHALCON_OBS_VAR(name);
phalcon_array_fetch_string(&name, reflection_data, SL("name"), PH_NOISY);
phalcon_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC);
/**
* Process annotation arguments
*/
if (phalcon_array_isset_string_fetch(&expr_arguments, reflection_data, SS("arguments"))) {
phalcon_is_iterable(expr_arguments, &ah0, &hp0, 0, 0);
PHALCON_INIT_VAR(arguments);
array_init_size(arguments, zend_hash_num_elements(ah0));
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
zval *n;
PHALCON_GET_HVALUE(argument);
PHALCON_OBS_NVAR(expr);
phalcon_array_fetch_string(&expr, argument, SL("expr"), PH_NOISY);
PHALCON_CALL_METHOD(&resolved_argument, this_ptr, "getexpression", expr);
if (phalcon_array_isset_string_fetch(&n, argument, SS("name"))) {
phalcon_array_update_zval(&arguments, n, resolved_argument, PH_COPY);
} else {
phalcon_array_append(&arguments, resolved_argument, 0);
}
zend_hash_move_forward_ex(ah0, &hp0);
}
phalcon_update_property_this(this_ptr, SL("_arguments"), arguments TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_exprArguments"), expr_arguments TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
开发者ID:100851766,项目名称:cphalcon,代码行数:60,代码来源:annotation.c
示例17: PHP_METHOD
/**
* Returns the messages generated in the validation
*
* @param boolean $byItemName
* @return array
*/
PHP_METHOD(Phalcon_Forms_Form, getMessages){
zval *by_item_name = NULL, *messages, *group = NULL, *element_messages = NULL;
zval *element = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &by_item_name) == FAILURE) {
RETURN_MM_NULL();
}
if (!by_item_name) {
PHALCON_INIT_VAR(by_item_name);
ZVAL_BOOL(by_item_name, 0);
}
PHALCON_OBS_VAR(messages);
phalcon_read_property(&messages, this_ptr, SL("_messages"), PH_NOISY_CC);
if (zend_is_true(by_item_name)) {
if (Z_TYPE_P(messages) != IS_ARRAY) {
PHALCON_INIT_VAR(group);
object_init_ex(group, phalcon_validation_message_group_ce);
PHALCON_CALL_METHOD_NORETURN(group, "__construct");
RETURN_CTOR(group);
}
RETURN_CCTOR(messages);
}
PHALCON_INIT_NVAR(group);
object_init_ex(group, phalcon_validation_message_group_ce);
PHALCON_CALL_METHOD_NORETURN(group, "__construct");
if (!phalcon_is_iterable(messages, &ah0, &hp0, 0, 0 TSRMLS_CC)) {
return;
}
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_FOREACH_KEY(element, ah0, hp0);
PHALCON_GET_FOREACH_VALUE(element_messages);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(group, "appendmessages", element_messages);
zend_hash_move_forward_ex(ah0, &hp0);
}
RETURN_CTOR(group);
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:61,代码来源:form.c
示例18: PHP_METHOD
/**
* Returns the annotations found in the methods' docblocks
*
* @return Phalcon\Annotations\Collection[]
*/
PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){
zval *annotations, *reflection_data, *reflection_methods;
zval *collections, *reflection_method = NULL, *method_name = NULL;
zval *collection = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(annotations);
phalcon_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC);
if (Z_TYPE_P(annotations) != IS_OBJECT) {
PHALCON_OBS_VAR(reflection_data);
phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string(reflection_data, SS("methods"))) {
PHALCON_OBS_VAR(reflection_methods);
phalcon_array_fetch_string(&reflection_methods, reflection_data, SL("methods"), PH_NOISY_CC);
if (phalcon_fast_count_ev(reflection_methods TSRMLS_CC)) {
PHALCON_INIT_VAR(collections);
array_init(collections);
phalcon_is_iterable(reflection_methods, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(method_name, ah0, hp0);
PHALCON_GET_HVALUE(reflection_method);
PHALCON_INIT_NVAR(collection);
object_init_ex(collection, phalcon_annotations_collection_ce);
phalcon_call_method_p1_noret(collection, "__construct", reflection_method);
phalcon_array_update_zval(&collections, method_name, &collection, PH_COPY | PH_SEPARATE TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
}
phalcon_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC);
RETURN_CTOR(collections);
}
}
phalcon_update_property_bool(this_ptr, SL("_methodAnnotations"), 0 TSRMLS_CC);
RETURN_MM_FALSE;
}
RETURN_CCTOR(annotations);
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:59,代码来源:reflection.c
示例19: PHP_METHOD
/**
* This method is automatically called in Phalcon\Db\Adapter\Pdo constructor.
* Call it when you need to restore a database connection.
*
* @param array $descriptor
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Oracle, connect) {
zval *descriptor = NULL, *startup, *value = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &descriptor);
if (!descriptor) {
PHALCON_INIT_VAR(descriptor);
} else {
PHALCON_SEPARATE_PARAM(descriptor);
}
if (!zend_is_true(descriptor)) {
PHALCON_OBS_NVAR(descriptor);
phalcon_read_property_this(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY TSRMLS_CC);
}
/**
* Connect
*/
PHALCON_CALL_PARENT(NULL, phalcon_db_adapter_pdo_oracle_ce, this_ptr, "connect", descriptor);
/**
* Database session settings initiated with each HTTP request. Oracle behaviour
* depends on particular NLS* parameter. Check if the developer has defined custom
* startup or create one from scratch
*/
if (phalcon_array_isset_string(descriptor, SS("startup"))) {
PHALCON_OBS_VAR(startup);
phalcon_array_fetch_string(&startup, descriptor, SL("startup"), PH_NOISY);
if (Z_TYPE_P(startup) == IS_ARRAY) {
phalcon_is_iterable(startup, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(value);
PHALCON_CALL_METHOD(NULL, this_ptr, "execute", value);
zend_hash_move_forward_ex(ah0, &hp0);
}
}
}
PHALCON_MM_RESTORE();
}
开发者ID:banketree,项目名称:cphalcon,代码行数:61,代码来源:oracle.c
示例20: PHP_METHOD
/**
* Stores cached content into the APC backend and stops the frontend
*
* @param string $keyName
* @param string $content
* @param long $lifetime
* @param boolean $stopBuffer
*/
PHP_METHOD(Phalcon_Cache_Multiple, save){
zval *key_name = NULL, *content = NULL, *lifetime = NULL, *stop_buffer = NULL;
zval *backends, *backend = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zzzz", &key_name, &content, &lifetime, &stop_buffer) == FAILURE) {
RETURN_MM_NULL();
}
if (!key_name) {
PHALCON_INIT_VAR(key_name);
}
if (!content) {
PHALCON_INIT_VAR(content);
}
if (!lifetime) {
PHALCON_INIT_VAR(lifetime);
}
if (!stop_buffer) {
PHALCON_INIT_VAR(stop_buffer);
ZVAL_BOOL(stop_buffer, 1);
}
PHALCON_OBS_VAR(backends);
phalcon_read_property(&backends, this_ptr, SL("_backends"), PH_NOISY_CC);
if (!phalcon_is_iterable(backends, &ah0, &hp0, 0, 0 TSRMLS_CC)) {
return;
}
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_FOREACH_VALUE(backend);
PHALCON_CALL_METHOD_PARAMS_4_NORETURN(backend, "save", key_name, content, lifetime, stop_buffer);
zend_hash_move_forward_ex(ah0, &hp0);
}
PHALCON_MM_RESTORE();
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:58,代码来源:multiple.c
注:本文中的phalcon_is_iterable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论