本文整理汇总了C++中PHALCON_CALL_METHOD_PARAMS_2函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_CALL_METHOD_PARAMS_2函数的具体用法?C++ PHALCON_CALL_METHOD_PARAMS_2怎么用?C++ PHALCON_CALL_METHOD_PARAMS_2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_CALL_METHOD_PARAMS_2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Gets creation options from a table
*
* @param string $tableName
* @param string $schemaName
* @return array
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, tableOptions){
zval *table_name = NULL, *schema_name = NULL, *dialect = NULL, *sql = NULL;
zval *describe = NULL, *first = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &table_name, &schema_name) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!schema_name) {
PHALCON_ALLOC_ZVAL_MM(schema_name);
ZVAL_NULL(schema_name);
}
PHALCON_INIT_VAR(dialect);
phalcon_read_property(&dialect, this_ptr, SL("_dialect"), PH_NOISY_CC);
PHALCON_INIT_VAR(sql);
PHALCON_CALL_METHOD_PARAMS_2(sql, dialect, "tableoptions", table_name, schema_name, PH_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_get_class_constant(t0, phalcon_db_ce, SL("FETCH_ASSOC") TSRMLS_CC);
PHALCON_INIT_VAR(describe);
PHALCON_CALL_METHOD_PARAMS_2(describe, this_ptr, "fetchall", sql, t0, PH_NO_CHECK);
PHALCON_INIT_VAR(first);
phalcon_array_fetch_long(&first, describe, 0, PH_NOISY_CC);
RETURN_CCTOR(first);
}
示例2: PHP_METHOD
/**
* Generates SQL checking for the existence of a schema.table
*
* @param string $tableName
* @param string $schemaName
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, tableExists){
zval *table_name = NULL, *schema_name = NULL, *sql = NULL, *num = NULL;
zval *t0 = NULL, *t1 = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &table_name, &schema_name) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!schema_name) {
PHALCON_ALLOC_ZVAL_MM(schema_name);
ZVAL_NULL(schema_name);
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_dialect"), PH_NOISY_CC);
PHALCON_INIT_VAR(sql);
PHALCON_CALL_METHOD_PARAMS_2(sql, t0, "tableexists", table_name, schema_name, PH_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_get_class_constant(t1, phalcon_db_ce, SL("FETCH_NUM") TSRMLS_CC);
PHALCON_INIT_VAR(num);
PHALCON_CALL_METHOD_PARAMS_2(num, this_ptr, "fetchone", sql, t1, PH_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(r0);
phalcon_array_fetch_long(&r0, num, 0, PH_NOISY_CC);
RETURN_CCTOR(r0);
}
示例3: PHP_METHOD
/**
* Sanizites a value with a specified single or set of filters
*
* @param mixed $value
* @param mixed $filters
* @return mixed
*/
PHP_METHOD(Phalcon_Filter, sanitize){
zval *value, *filters, *new_value = NULL, *filter = NULL, *filter_value = NULL;
zval *sanizited_value;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &value, &filters) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(filters) == IS_ARRAY) {
PHALCON_CPY_WRT(new_value, value);
if (Z_TYPE_P(value) != IS_NULL) {
if (!phalcon_valid_foreach(filters TSRMLS_CC)) {
return;
}
ah0 = Z_ARRVAL_P(filters);
zend_hash_internal_pointer_reset_ex(ah0, &hp0);
ph_cycle_start_0:
if (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS) {
goto ph_cycle_end_0;
}
PHALCON_GET_FOREACH_VALUE(filter);
PHALCON_INIT_NVAR(filter_value);
PHALCON_CALL_METHOD_PARAMS_2(filter_value, this_ptr, "_sanitize", new_value, filter, PH_NO_CHECK);
PHALCON_CPY_WRT(new_value, filter_value);
zend_hash_move_forward_ex(ah0, &hp0);
goto ph_cycle_start_0;
ph_cycle_end_0:
if(0){}
}
RETURN_CCTOR(new_value);
}
PHALCON_INIT_VAR(sanizited_value);
PHALCON_CALL_METHOD_PARAMS_2(sanizited_value, this_ptr, "_sanitize", value, filters, PH_NO_CHECK);
RETURN_CCTOR(sanizited_value);
}
示例4: PHP_METHOD
/**
* Receives events generated in the models and dispatches them to a events-manager if available
* Notify the behaviors that are listening in the model
*
* @param string $eventName
* @param Phalcon\Mvc\CollectionInterface $model
*/
PHP_METHOD(Phalcon_Mvc_Collection_Manager, notifyEvent){
zval *event_name, *model, *status = NULL, *events_manager;
zval *fire_event_name = NULL, *custom_events_manager;
zval *entity_name;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &event_name, &model);
PHALCON_INIT_VAR(status);
/**
* Dispatch events to the global events manager
*/
PHALCON_OBS_VAR(events_manager);
phalcon_read_property_this(&events_manager, this_ptr, SL("_eventsManager"), PH_NOISY_CC);
if (Z_TYPE_P(events_manager) == IS_OBJECT) {
PHALCON_INIT_VAR(fire_event_name);
PHALCON_CONCAT_SV(fire_event_name, "collection:", event_name);
PHALCON_CALL_METHOD_PARAMS_2(status, events_manager, "fire", fire_event_name, model);
if (PHALCON_IS_FALSE(status)) {
RETURN_CCTOR(status);
}
}
/**
* A model can has a specific events manager for it
*/
PHALCON_OBS_VAR(custom_events_manager);
phalcon_read_property_this(&custom_events_manager, this_ptr, SL("_customEventsManager"), PH_NOISY_CC);
if (Z_TYPE_P(custom_events_manager) == IS_ARRAY) {
PHALCON_INIT_VAR(entity_name);
phalcon_get_class(entity_name, model, 1 TSRMLS_CC);
if (phalcon_array_isset(custom_events_manager, entity_name)) {
PHALCON_INIT_NVAR(fire_event_name);
PHALCON_CONCAT_SV(fire_event_name, "collection:", event_name);
PHALCON_INIT_NVAR(status);
PHALCON_CALL_METHOD_PARAMS_2(status, custom_events_manager, "fire", fire_event_name, model);
if (PHALCON_IS_FALSE(status)) {
RETURN_CCTOR(status);
}
}
}
RETURN_CCTOR(status);
}
示例5: PHP_METHOD
/**
* Generates SQL checking for the existence of a schema.table
*
*
*
* @param string $tableName
* @param string $schemaName
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Mysql, tableExists){
zval *table_name = NULL, *schema_name = NULL, *sql = NULL, *num = NULL;
zval *r0 = NULL, *r1 = NULL, *r2 = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &table_name, &schema_name) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!schema_name) {
PHALCON_INIT_VAR(schema_name);
ZVAL_NULL(schema_name);
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_STATIC_PARAMS_2(r0, "phalcon_db_dialect_mysql", "tableexists", table_name, schema_name);
PHALCON_CPY_WRT(sql, r0);
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_INIT_VAR(t0);
ZVAL_LONG(t0, 2);
PHALCON_CALL_METHOD_PARAMS_2(r1, this_ptr, "fetchone", sql, t0, PHALCON_NO_CHECK);
PHALCON_CPY_WRT(num, r1);
PHALCON_ALLOC_ZVAL_MM(r2);
phalcon_array_fetch_long(&r2, num, 0, PHALCON_NOISY TSRMLS_CC);
RETURN_CHECK_CTOR(r2);
}
示例6: PHP_METHOD
/**
* Returns the translation string of the given key
*
* @param string $translateKey
* @param array $placeholders
* @return string
*/
PHP_METHOD(Phalcon_Translate, _){
zval *translate_key = NULL, *placeholders = NULL;
zval *a0 = NULL;
zval *r0 = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &translate_key, &placeholders) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!placeholders) {
PHALCON_INIT_VAR(a0);
array_init(a0);
PHALCON_CPY_WRT(placeholders, a0);
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_adapter"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CALL_METHOD_PARAMS_2(r0, t0, "query", translate_key, placeholders, PHALCON_NO_CHECK);
RETURN_DZVAL(r0);
}
示例7: PHP_METHOD
/**
* Returns the reverse column map if any
*
*<code>
* print_r($metaData->getReverseColumnMap(new Robots()));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, getReverseColumnMap){
zval *model, *index, *data;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &model) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_INIT_VAR(index);
ZVAL_LONG(index, 1);
PHALCON_INIT_VAR(data);
PHALCON_CALL_METHOD_PARAMS_2(data, this_ptr, "readcolumnmapindex", model, index);
if (Z_TYPE_P(data) != IS_NULL) {
if (Z_TYPE_P(data) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "The meta-data is invalid or is corrupted");
return;
}
}
RETURN_CCTOR(data);
}
示例8: PHP_METHOD
/**
* Renders a view using the template engine
*
* @param string $path
* @param array $params
*/
PHP_METHOD(Phalcon_View_Engine_Mustache, render){
zval *path = NULL, *params = NULL;
zval *t0 = NULL, *t1 = NULL;
zval *r0 = NULL, *r1 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &path, ¶ms) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
phalcon_update_property_zval(this_ptr, SL("_params"), params TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_view"), PHALCON_NOISY TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, SL("_mustache"), PHALCON_NOISY TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_CALL_FUNC_PARAMS_1(r1, "file_get_contents", path);
PHALCON_CALL_METHOD_PARAMS_2(r0, t1, "render", r1, this_ptr, PHALCON_NO_CHECK);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(t0, "setcontent", r0, PHALCON_NO_CHECK);
PHALCON_MM_RESTORE();
}
示例9: PHP_METHOD
/**
* Starts a cache. The $keyname allows to identify the created fragment
*
* @param int|string $keyName
* @param long $lifetime
* @return mixed
*/
PHP_METHOD(Phalcon_Cache_Backend, start){
zval *key_name, *lifetime = NULL, *existing_cache, *fresh = NULL;
zval *frontend;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &key_name, &lifetime);
if (!lifetime) {
PHALCON_INIT_VAR(lifetime);
}
/**
* Get the cache content verifying if it was expired
*/
PHALCON_INIT_VAR(existing_cache);
PHALCON_CALL_METHOD_PARAMS_2(existing_cache, this_ptr, "get", key_name, lifetime);
if (Z_TYPE_P(existing_cache) == IS_NULL) {
PHALCON_INIT_VAR(fresh);
ZVAL_BOOL(fresh, 1);
PHALCON_OBS_VAR(frontend);
phalcon_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
PHALCON_CALL_METHOD_NORETURN(frontend, "start");
} else {
PHALCON_INIT_NVAR(fresh);
ZVAL_BOOL(fresh, 0);
}
phalcon_update_property_this(this_ptr, SL("_fresh"), fresh TSRMLS_CC);
phalcon_update_property_bool(this_ptr, SL("_started"), 1 TSRMLS_CC);
RETURN_CCTOR(existing_cache);
}
示例10: PHP_METHOD
/**
* Sends/Writes messages to the file log
*
* @param string $message
* @param int $type
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, log){
zval *message = NULL, *type = NULL, *msg = NULL;
zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL;
zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
zval *c0 = NULL;
zval *i0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &message, &type) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "_fileHandler", sizeof("_fileHandler")-1, PHALCON_NOISY TSRMLS_CC);
if (!zend_is_true(t0)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "Cannot send message to the log because it is invalid");
return;
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_FUNC_PARAMS_1(r0, "is_scalar", message, 0x045);
if (zend_is_true(r0)) {
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_INIT_VAR(c0);
ZVAL_BOOL(c0, 1);
PHALCON_CALL_FUNC_PARAMS_2(r1, "print_r", message, c0, 0x008);
PHALCON_CPY_WRT(msg, r1);
}
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, "_transaction", sizeof("_transaction")-1, PHALCON_NOISY TSRMLS_CC);
if (zend_is_true(t1)) {
PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, phalcon_logger_item_ce);
PHALCON_ALLOC_ZVAL_MM(r2);
PHALCON_CALL_FUNC(r2, "time", 0x018);
PHALCON_CALL_METHOD_PARAMS_3_NORETURN(i0, "__construct", message, type, r2, PHALCON_CHECK);
PHALCON_ALLOC_ZVAL_MM(t2);
phalcon_read_property(&t2, this_ptr, "_quenue", sizeof("_quenue")-1, PHALCON_NOISY TSRMLS_CC);
phalcon_array_append(&t2, i0, PHALCON_NO_SEPARATE_THX TSRMLS_CC);
phalcon_update_property_zval(this_ptr, "_quenue", strlen("_quenue"), t2 TSRMLS_CC);
} else {
PHALCON_ALLOC_ZVAL_MM(t3);
phalcon_read_property(&t3, this_ptr, "_fileHandler", sizeof("_fileHandler")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(r3);
PHALCON_ALLOC_ZVAL_MM(r4);
PHALCON_CALL_METHOD_PARAMS_2(r4, this_ptr, "_applyformat", message, type, PHALCON_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(t4);
zend_get_constant("PHP_EOL", strlen("PHP_EOL"), t4 TSRMLS_CC);
PHALCON_CONCAT_VV(r3, r4, t4);
PHALCON_CALL_FUNC_PARAMS_2_NORETURN("fputs", t3, r3, 0x04F);
}
PHALCON_MM_RESTORE();
}
示例11: PHP_METHOD
/**
* List all tables on a database
*
* @param string $schemaName
* @return array
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, listTables){
zval *schema_name = NULL, *sql = NULL, *tables = NULL, *all_tables = NULL, *table = NULL;
zval *t0 = NULL, *t1 = NULL;
zval *r0 = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &schema_name) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!schema_name) {
PHALCON_ALLOC_ZVAL_MM(schema_name);
ZVAL_NULL(schema_name);
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_dialect"), PH_NOISY_CC);
PHALCON_INIT_VAR(sql);
PHALCON_CALL_METHOD_PARAMS_1(sql, t0, "listtables", schema_name, PH_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_get_class_constant(t1, phalcon_db_ce, SL("FETCH_NUM") TSRMLS_CC);
PHALCON_INIT_VAR(tables);
PHALCON_CALL_METHOD_PARAMS_2(tables, this_ptr, "fetchall", sql, t1, PH_NO_CHECK);
PHALCON_INIT_VAR(all_tables);
array_init(all_tables);
if (!phalcon_valid_foreach(tables TSRMLS_CC)) {
return;
}
ah0 = Z_ARRVAL_P(tables);
zend_hash_internal_pointer_reset_ex(ah0, &hp0);
fes_7f5d_3:
if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){
goto fee_7f5d_3;
}
PHALCON_INIT_VAR(table);
ZVAL_ZVAL(table, *hd, 1, 0);
PHALCON_INIT_VAR(r0);
phalcon_array_fetch_long(&r0, table, 0, PH_NOISY_CC);
phalcon_array_append(&all_tables, r0, PH_SEPARATE TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
goto fes_7f5d_3;
fee_7f5d_3:
if(0){}
RETURN_CTOR(all_tables);
}
示例12: PHP_METHOD
/**
* Gets variable from $_GET superglobal applying filters if needed
*
*<code>
* //Returns value from $_GET["id"] without sanitizing
* $id = $request->getQuery("id");
*
* //Returns value from $_GET["id"] with sanitizing
* $id = $request->getQuery("id", "int");
*
* //Returns value from $_GET["id"] with a default value
* $id = $request->getQuery("id", null, 150);
*</code>
*
* @param string $name
* @param string|array $filters
* @param mixed $defaultValue
* @return mixed
*/
PHP_METHOD(Phalcon_Http_Request, getQuery) {
zval *name, *filters = NULL, *default_value = NULL, *value, *filter = NULL;
zval *dependency_injector, *service, *sanitized_value;
zval *g0 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|zz", &name, &filters, &default_value) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!filters) {
PHALCON_INIT_NVAR(filters);
}
if (!default_value) {
PHALCON_INIT_NVAR(default_value);
}
phalcon_get_global(&g0, SL("_GET")+1 TSRMLS_CC);
eval_int = phalcon_array_isset(g0, name);
if (eval_int) {
PHALCON_INIT_VAR(value);
phalcon_array_fetch(&value, g0, name, PH_NOISY_CC);
if (Z_TYPE_P(filters) != IS_NULL) {
PHALCON_INIT_VAR(filter);
phalcon_read_property(&filter, this_ptr, SL("_filter"), PH_NOISY_CC);
if (Z_TYPE_P(filter) != IS_OBJECT) {
PHALCON_INIT_VAR(dependency_injector);
phalcon_read_property(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_http_request_exception_ce, "A dependency injection object is required to access the 'filter' service");
return;
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "filter", 1);
PHALCON_INIT_NVAR(filter);
PHALCON_CALL_METHOD_PARAMS_1(filter, dependency_injector, "getshared", service, PH_NO_CHECK);
phalcon_update_property_zval(this_ptr, SL("_filter"), filter TSRMLS_CC);
}
PHALCON_INIT_VAR(sanitized_value);
PHALCON_CALL_METHOD_PARAMS_2(sanitized_value, filter, "sanitize", value, filters, PH_NO_CHECK);
RETURN_CCTOR(sanitized_value);
} else {
RETURN_CCTOR(value);
}
}
RETURN_CCTOR(default_value);
}
示例13: PHP_METHOD
/**
* Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role
*
* Example:
* <code>
* $acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultant');
* $acl->addRole('administrator', 'consultant');
* </code>
*
* @param Phalcon\Acl\RoleInterface $role
* @param array|string $accessInherits
* @return boolean
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, addRole){
zval *role, *access_inherits = NULL, *role_name = NULL, *object = NULL;
zval *roles_names, *default_access, *_access;
zval *success;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &role, &access_inherits) == FAILURE) {
RETURN_MM_NULL();
}
if (!access_inherits) {
PHALCON_INIT_VAR(access_inherits);
}
if (Z_TYPE_P(role) == IS_OBJECT) {
PHALCON_INIT_VAR(role_name);
PHALCON_CALL_METHOD(role_name, role, "getname");
PHALCON_CPY_WRT(object, role);
} else {
PHALCON_CPY_WRT(role_name, role);
PHALCON_INIT_VAR(object);
object_init_ex(object, phalcon_acl_role_ce);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(object, "__construct", role);
}
PHALCON_OBS_VAR(roles_names);
phalcon_read_property(&roles_names, this_ptr, SL("_rolesNames"), PH_NOISY_CC);
if (phalcon_array_isset(roles_names, role_name)) {
RETURN_MM_FALSE;
}
phalcon_update_property_array_append(this_ptr, SL("_roles"), object TSRMLS_CC);
PHALCON_INIT_VAR(t0);
ZVAL_BOOL(t0, 1);
phalcon_update_property_array(this_ptr, SL("_rolesNames"), role_name, t0 TSRMLS_CC);
PHALCON_OBS_VAR(default_access);
phalcon_read_property(&default_access, this_ptr, SL("_defaultAccess"), PH_NOISY_CC);
PHALCON_OBS_VAR(_access);
phalcon_read_property(&_access, this_ptr, SL("_access"), PH_NOISY_CC);
phalcon_array_update_zval_string_string_multi_3(&_access, role_name, SL("*"), SL("*"), &default_access, 0 TSRMLS_CC);
if (Z_TYPE_P(access_inherits) != IS_NULL) {
PHALCON_INIT_VAR(success);
PHALCON_CALL_METHOD_PARAMS_2(success, this_ptr, "addinherit", role_name, access_inherits);
RETURN_CCTOR(success);
}
RETURN_MM_TRUE;
}
示例14: PHP_METHOD
/**
* Create internal connection to memcached
*/
PHP_METHOD(Phalcon_Cache_Backend_Memcache, _connect){
zval *options, *memcache, *host, *port, *persistent;
zval *success = NULL;
zend_class_entry *ce0;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(options);
phalcon_read_property(&options, this_ptr, SL("_options"), PH_NOISY_CC);
ce0 = zend_fetch_class(SL("Memcache"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
PHALCON_INIT_VAR(memcache);
object_init_ex(memcache, ce0);
if (phalcon_has_constructor(memcache TSRMLS_CC)) {
PHALCON_CALL_METHOD_NORETURN(memcache, "__construct");
}
PHALCON_OBS_VAR(host);
phalcon_array_fetch_string(&host, options, SL("host"), PH_NOISY_CC);
PHALCON_OBS_VAR(port);
phalcon_array_fetch_string(&port, options, SL("port"), PH_NOISY_CC);
PHALCON_OBS_VAR(persistent);
phalcon_array_fetch_string(&persistent, options, SL("persistent"), PH_NOISY_CC);
if (zend_is_true(persistent)) {
PHALCON_INIT_VAR(success);
PHALCON_CALL_METHOD_PARAMS_2(success, memcache, "pconnect", host, port);
} else {
PHALCON_INIT_NVAR(success);
PHALCON_CALL_METHOD_PARAMS_2(success, memcache, "connect", host, port);
}
if (!zend_is_true(success)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server");
return;
}
phalcon_update_property_zval(this_ptr, SL("_memcache"), memcache TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例15: PHP_METHOD
/**
* Sends/Writes messages to the file log
*
* @param string $message
* @param int $type
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, log){
zval *message, *type = NULL, *file_handler, *transaction;
zval *time, *quenue_item, *applied_format, *eol;
zval *applied_eol;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &message, &type) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!type) {
PHALCON_INIT_NVAR(type);
ZVAL_LONG(type, 7);
}
PHALCON_INIT_VAR(file_handler);
phalcon_read_property(&file_handler, this_ptr, SL("_fileHandler"), PH_NOISY_CC);
if (!zend_is_true(file_handler)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "Cannot send message to the log because it is invalid");
return;
}
PHALCON_INIT_VAR(transaction);
phalcon_read_property(&transaction, this_ptr, SL("_transaction"), PH_NOISY_CC);
if (zend_is_true(transaction)) {
PHALCON_INIT_VAR(time);
PHALCON_CALL_FUNC(time, "time");
PHALCON_INIT_VAR(quenue_item);
object_init_ex(quenue_item, phalcon_logger_item_ce);
PHALCON_CALL_METHOD_PARAMS_3_NORETURN(quenue_item, "__construct", message, type, time, PH_CHECK);
PHALCON_INIT_VAR(t0);
phalcon_read_property(&t0, this_ptr, SL("_quenue"), PH_NOISY_CC);
phalcon_array_append(&t0, quenue_item, 0 TSRMLS_CC);
phalcon_update_property_zval(this_ptr, SL("_quenue"), t0 TSRMLS_CC);
} else {
PHALCON_INIT_VAR(applied_format);
PHALCON_CALL_METHOD_PARAMS_2(applied_format, this_ptr, "_applyformat", message, type, PH_NO_CHECK);
PHALCON_INIT_VAR(eol);
zend_get_constant(SL("PHP_EOL"), eol TSRMLS_CC);
PHALCON_INIT_VAR(applied_eol);
PHALCON_CONCAT_VV(applied_eol, applied_format, eol);
PHALCON_CALL_FUNC_PARAMS_2_NORETURN("fwrite", file_handler, applied_eol);
}
PHALCON_MM_RESTORE();
}