예제 #1
0
/**
 * 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();
}
예제 #2
0
파일: bag.c 프로젝트: DonOzone/cphalcon
/**
 * Removes a property from the internal bag
 *
 *<code>
 * $user->remove('name');
 *</code>
 *
 * @param string $property
 * @return boolean
 */
PHP_METHOD(Phalcon_Session_Bag, remove){

	zval *property, *data = NULL, *name, *session;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 0, &property);
	
	PHALCON_OBS_VAR(data);
	phalcon_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC);
	if (phalcon_array_isset(data, property)) {
		phalcon_unset_property_array(this_ptr, SL("_data"), property TSRMLS_CC);
	
		PHALCON_OBS_NVAR(data);
		phalcon_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC);
	
		PHALCON_OBS_VAR(name);
		phalcon_read_property_this(&name, this_ptr, SL("_name"), PH_NOISY_CC);
	
		PHALCON_OBS_VAR(session);
		phalcon_read_property_this(&session, this_ptr, SL("_session"), PH_NOISY_CC);
		phalcon_call_method_p2_noret(session, "set", name, data);
		RETURN_MM_TRUE;
	}
	
	RETURN_MM_FALSE;
}
예제 #3
0
파일: registry.c 프로젝트: Myleft/cphalcon7
/**
 * @brief void Phalcon\Registry::offsetUnset(mixed $offset)
 */
PHP_METHOD(Phalcon_Registry, offsetUnset){
	zval *property;

	phalcon_fetch_params(0, 1, 0, &property);

	phalcon_unset_property_array(getThis(), SL("_data"), property);
}
예제 #4
0
파일: uri.c 프로젝트: Myleft/cphalcon7
/**
 * Magic __unset method
 *
 * @param string $key
 */
PHP_METHOD(Phalcon_Http_Uri, __unset){

	zval *key;

	phalcon_fetch_params(0, 1, 0, &key);

	phalcon_unset_property_array(getThis(), SL("_parts"), key);
}
예제 #5
0
파일: di.c 프로젝트: googlle/cphalcon7
/**
 * Removes a service in the services container
 *
 * @param string $name
 */
PHP_METHOD(Phalcon_DI, remove){

	zval *name;

	phalcon_fetch_params(0, 1, 0, &name);
	PHALCON_ENSURE_IS_STRING(name);

	phalcon_unset_property_array(getThis(), SL("_services"), name);
}
예제 #6
0
파일: di.c 프로젝트: 11mariom/cphalcon
/**
 * Removes a service in the services container
 *
 * @param string $name
 */
PHP_METHOD(Phalcon_DI, remove){

	zval *name;

	phalcon_fetch_params(0, 1, 0, &name);
	
	if (Z_TYPE_P(name) != IS_STRING) {
		PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "The service name must be a string");
		return;
	}
	phalcon_unset_property_array(this_ptr, SL("_services"), name TSRMLS_CC);
	
}
예제 #7
0
파일: bag.c 프로젝트: BlueShark/cphalcon
/**
 * Removes a property from the internal bag
 *
 *<code>
 * $user->remove('name'));
 *</code>
 *
 * @param string $property
 * @return boolean
 */
PHP_METHOD(Phalcon_Session_Bag, remove){

	zval *property, *data;

	PHALCON_MM_GROW();

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &property) == FAILURE) {
		RETURN_MM_NULL();
	}

	PHALCON_OBS_VAR(data);
	phalcon_read_property(&data, this_ptr, SL("_data"), PH_NOISY_CC);
	if (phalcon_array_isset(data, property)) {
		phalcon_unset_property_array(this_ptr, SL("_data"), property TSRMLS_CC);
		RETURN_MM_TRUE;
	}
	
	RETURN_MM_FALSE;
}
예제 #8
0
파일: form.c 프로젝트: BlueShark/cphalcon
/**
 * Removes an element from the form
 *
 * @param string $name
 * @return boolean
 */
PHP_METHOD(Phalcon_Forms_Form, remove){

	zval *name, *elements;

	PHALCON_MM_GROW();

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &name) == FAILURE) {
		RETURN_MM_NULL();
	}

	PHALCON_OBS_VAR(elements);
	phalcon_read_property(&elements, this_ptr, SL("_elements"), PH_NOISY_CC);
	if (phalcon_array_isset(elements, name)) {
		phalcon_unset_property_array(this_ptr, SL("_elements"), name TSRMLS_CC);
		RETURN_MM_TRUE;
	}
	
	RETURN_MM_FALSE;
}