本文整理汇总了C++中phalcon_is_iterable函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_is_iterable函数的具体用法?C++ phalcon_is_iterable怎么用?C++ phalcon_is_iterable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phalcon_is_iterable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}