当前位置: 首页>>代码示例>>C++>>正文


C++ PHALCON_IS_FALSE函数代码示例

本文整理汇总了C++中PHALCON_IS_FALSE函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_IS_FALSE函数的具体用法?C++ PHALCON_IS_FALSE怎么用?C++ PHALCON_IS_FALSE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PHALCON_IS_FALSE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PHP_METHOD

/**
 * Isset property
 *
 * @param string $property
 * @return boolean
 */
PHP_METHOD(Phalcon_Session_Bag, __isset){

	zval *property, *initalized, *data;
	int eval_int;

	PHALCON_MM_GROW();

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

	PHALCON_INIT_VAR(initalized);
	phalcon_read_property(&initalized, this_ptr, SL("_initalized"), PH_NOISY_CC);
	if (PHALCON_IS_FALSE(initalized)) {
		PHALCON_CALL_METHOD_NORETURN(this_ptr, "initialize", PH_NO_CHECK);
	}
	
	PHALCON_INIT_VAR(data);
	phalcon_read_property(&data, this_ptr, SL("_data"), PH_NOISY_CC);
	eval_int = phalcon_array_isset(data, property);
	if (eval_int) {
		PHALCON_MM_RESTORE();
		RETURN_TRUE;
	}
	
	PHALCON_MM_RESTORE();
	RETURN_FALSE;
}
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:35,代码来源:bag.c

示例2: PHP_METHOD

/**
 * Register an array of modules present in the jsonrpc
 *
 *<code>
 *	$this->registerModules(array(
 *		'frontend' => array(
 *			'className' => 'Multiple\Frontend\Module',
 *			'path' => '../apps/frontend/Module.php'
 *		),
 *		'backend' => array(
 *			'className' => 'Multiple\Backend\Module',
 *			'path' => '../apps/backend/Module.php'
 *		)
 *	));
 *</code>
 *
 * @param array $modules
 * @param boolean $merge
 * @param Phalcon\Mvc\JsonRpc
 */
PHP_METHOD(Phalcon_Mvc_JsonRpc, registerModules){

	zval *modules, *merge = NULL, *registered_modules, *merged_modules = NULL;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 1, &modules, &merge);
	
	if (!merge) {
		merge = &PHALCON_GLOBAL(z_false);
	}
	
	if (Z_TYPE_P(modules) != IS_ARRAY) { 
		PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_jsonrpc_exception_ce, "Modules must be an Array");
		return;
	}
	if (PHALCON_IS_FALSE(merge)) {
		phalcon_update_property_this(getThis(), SL("_modules"), modules);
	} else {
		registered_modules = phalcon_read_property(getThis(), SL("_modules"), PH_NOISY);
		if (Z_TYPE_P(registered_modules) == IS_ARRAY) { 
			PHALCON_INIT_VAR(merged_modules);
			phalcon_fast_array_merge(merged_modules, registered_modules, modules);
		} else {
			PHALCON_CPY_WRT(merged_modules, modules);
		}
	
		phalcon_update_property_this(getThis(), SL("_modules"), merged_modules);
	}
	
	RETURN_THIS();
}
开发者ID:Myleft,项目名称:cphalcon7,代码行数:52,代码来源:jsonrpc.c

示例3: PHP_METHOD

/**
 * Sets a value in the session bag
 *
 *<code>
 * $user->set('name', 'Kimbra');
 *</code>
 *
 * @param string $property
 * @param string $value
 */
PHP_METHOD(Phalcon_Session_Bag, set){

	zval *property, *value, *initalized, *name, *data;
	zval *session;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 2, 0, &property, &value);
	
	PHALCON_OBS_VAR(initalized);
	phalcon_read_property_this(&initalized, this_ptr, SL("_initalized"), PH_NOISY_CC);
	if (PHALCON_IS_FALSE(initalized)) {
		phalcon_call_method_noret(this_ptr, "initialize");
	}
	
	phalcon_update_property_array(this_ptr, SL("_data"), property, value TSRMLS_CC);
	
	PHALCON_OBS_VAR(name);
	phalcon_read_property_this(&name, this_ptr, SL("_name"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(data);
	phalcon_read_property_this(&data, this_ptr, SL("_data"), 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);
	
	PHALCON_MM_RESTORE();
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:39,代码来源:bag.c

示例4: PHP_METHOD

/**
 * Throws an internal exception
 *
 * @param string $message
 * @param int $exceptionCode
 */
PHP_METHOD(Phalcon_CLI_Dispatcher, _throwDispatchException) {

    zval *message, *exception_code = NULL, *exception, *events_manager;
    zval *event_name, *status;

    PHALCON_MM_GROW();

    phalcon_fetch_params(1, 1, 1, &message, &exception_code);

    if (!exception_code) {
        PHALCON_INIT_VAR(exception_code);
        ZVAL_LONG(exception_code, 0);
    }

    PHALCON_INIT_VAR(exception);
    object_init_ex(exception, phalcon_cli_dispatcher_exception_ce);
    phalcon_call_method_p2_noret(exception, "__construct", message, exception_code);

    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(event_name);
        ZVAL_STRING(event_name, "dispatch:beforeException", 1);

        PHALCON_INIT_VAR(status);
        phalcon_call_method_p3(status, events_manager, "fire", event_name, this_ptr, exception);
        if (PHALCON_IS_FALSE(status)) {
            RETURN_MM_FALSE;
        }
    }

    phalcon_throw_exception(exception TSRMLS_CC);
    return;
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:41,代码来源:dispatcher.c

示例5: PHP_METHOD

/**
 * 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;
	zval *initialized;

	PHALCON_MM_GROW();

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

	PHALCON_OBS_VAR(initialized);
	phalcon_read_property_this(&initialized, this_ptr, SL("_initialized"), PH_NOISY_CC);
	if (PHALCON_IS_FALSE(initialized)) {
		phalcon_call_method_noret(this_ptr, "initialize");
	}

	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;
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:44,代码来源:bag.c

示例6: PHP_METHOD

/**
 * Returns the content of the resource as an string
 * Optionally a base path where the resource is located can be set
 *
 * @param string $basePath
 * @return string
 */
PHP_METHOD(Phalcon_Assets_Resource, getContent){

	zval *base_path = NULL, *source_path = NULL, *complete_path;
	zval *local, *exception_message = NULL, *content;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 0, 1, &base_path);
	
	if (!base_path) {
		PHALCON_INIT_VAR(base_path);
	}
	
	PHALCON_OBS_VAR(source_path);
	phalcon_read_property_this(&source_path, this_ptr, SL("_sourcePath"), PH_NOISY_CC);
	if (PHALCON_IS_EMPTY(source_path)) {
		PHALCON_OBS_NVAR(source_path);
		phalcon_read_property_this(&source_path, this_ptr, SL("_path"), PH_NOISY_CC);
	}
	
	/** 
	 * A base path for resources can be set in the assets manager
	 */
	PHALCON_INIT_VAR(complete_path);
	PHALCON_CONCAT_VV(complete_path, base_path, source_path);
	
	PHALCON_OBS_VAR(local);
	phalcon_read_property_this(&local, this_ptr, SL("_local"), PH_NOISY_CC);
	
	/** 
	 * Local resources are loaded from the local disk
	 */
	if (zend_is_true(local)) {
	
		/** 
		 * Check first if the file is readable
		 */
		if (phalcon_file_exists(complete_path TSRMLS_CC) == FAILURE) {
			PHALCON_INIT_VAR(exception_message);
			PHALCON_CONCAT_SVS(exception_message, "Resource's content for \"", complete_path, "\" cannot be loaded");
			PHALCON_THROW_EXCEPTION_ZVAL(phalcon_assets_exception_ce, exception_message);
			return;
		}
	}
	
	/** 
	 * Use file_get_contents to respect the openbase_dir. Access urls must be enabled
	 */
	PHALCON_INIT_VAR(content);
	phalcon_file_get_contents(content, complete_path TSRMLS_CC);
	if (PHALCON_IS_FALSE(content)) {
		PHALCON_INIT_NVAR(exception_message);
		PHALCON_CONCAT_SVS(exception_message, "Resource's content for \"", complete_path, "\" cannot be read");
		PHALCON_THROW_EXCEPTION_ZVAL(phalcon_assets_exception_ce, exception_message);
		return;
	}
	
	RETURN_CCTOR(content);
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:66,代码来源:resource.c

示例7: PHP_METHOD

/**
 * Executes the validation
 *
 * @param Phalcon\Validation $validator
 * @param string $attribute
 * @return boolean
 */
PHP_METHOD(Phalcon_Validation_Validator_Identical, validate){

	zval *validator, *attribute, *value = NULL, *identical_value, *valid = NULL;
	zval *message_str, *message, *code;
	zval *label, *pairs, *prepared = NULL;
	zend_class_entry *ce = Z_OBJCE_P(getThis());

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 2, 0, &validator, &attribute);
	
	PHALCON_VERIFY_CLASS_EX(validator, phalcon_validation_ce, phalcon_validation_exception_ce, 1);

	PHALCON_CALL_METHOD(&value, validator, "getvalue", attribute);
	
	PHALCON_OBS_VAR(identical_value);
	RETURN_MM_ON_FAILURE(phalcon_validation_validator_getoption_helper(ce, &identical_value, getThis(), ISV(value)));

	PHALCON_CALL_SELF(&valid, "valid", value, identical_value);
	
	if (PHALCON_IS_FALSE(valid)) {
		PHALCON_OBS_VAR(label);
		RETURN_MM_ON_FAILURE(phalcon_validation_validator_getoption_helper(ce, &label, getThis(), ISV(label)));
		if (!zend_is_true(label)) {
			PHALCON_CALL_METHOD(&label, validator, "getlabel", attribute);
			if (!zend_is_true(label)) {
				PHALCON_CPY_WRT(label, attribute);
			}
		}

		PHALCON_ALLOC_INIT_ZVAL(pairs);
		array_init_size(pairs, 1);
		Z_TRY_ADDREF_P(label); add_assoc_zval_ex(pairs, SL(":field"), label);

		PHALCON_OBS_VAR(message_str);
		RETURN_MM_ON_FAILURE(phalcon_validation_validator_getoption_helper(ce, &message_str, getThis(), ISV(message)));
		if (!zend_is_true(message_str)) {
			PHALCON_OBSERVE_OR_NULLIFY_VAR(message_str);
			RETURN_MM_ON_FAILURE(phalcon_validation_getdefaultmessage_helper(Z_OBJCE_P(validator), message_str, validator, "Identical"));
		}
	
		PHALCON_OBS_VAR(code);
		RETURN_MM_ON_FAILURE(phalcon_validation_validator_getoption_helper(ce, &code, getThis(), ISV(code)));
		if (Z_TYPE_P(code) == IS_NULL) {
			ZVAL_LONG(code, 0);
		}

		PHALCON_CALL_FUNCTION(&prepared, "strtr", message_str, pairs);

		message = phalcon_validation_message_construct_helper(prepared, attribute, "Identical", code);
		Z_TRY_DELREF_P(message);
	
		PHALCON_CALL_METHOD(NULL, validator, "appendmessage", message);
		RETURN_MM_FALSE;
	}
	
	RETURN_MM_TRUE;
}
开发者ID:Myleft,项目名称:cphalcon7,代码行数:65,代码来源:identical.c

示例8: PHP_METHOD

/**
 * Prints out HTTP response to the client
 *
 * @return Phalcon\Http\ResponseInterface
 */
PHP_METHOD(Phalcon_Http_Response, send){

	zval *sent, *headers, *cookies, *content, *file;

	PHALCON_MM_GROW();

	PHALCON_OBS_VAR(sent);
	phalcon_read_property_this(&sent, this_ptr, SL("_sent"), PH_NOISY_CC);
	if (PHALCON_IS_FALSE(sent)) {
	
		/** 
		 * Send headers
		 */
		PHALCON_OBS_VAR(headers);
		phalcon_read_property_this(&headers, this_ptr, SL("_headers"), PH_NOISY_CC);
		if (Z_TYPE_P(headers) == IS_OBJECT) {
			phalcon_call_method_noret(headers, "send");
		}
	
		PHALCON_OBS_VAR(cookies);
		phalcon_read_property_this(&cookies, this_ptr, SL("_cookies"), PH_NOISY_CC);
		if (Z_TYPE_P(cookies) == IS_OBJECT) {
			phalcon_call_method_noret(cookies, "send");
		}
	
		/** 
		 * Output the response body
		 */
		PHALCON_OBS_VAR(content);
		phalcon_read_property_this(&content, this_ptr, SL("_content"), PH_NOISY_CC);
		if (Z_STRLEN_P(content)) {
			zend_print_zval(content, 0);
		}
		else {
			PHALCON_OBS_VAR(file);
			phalcon_read_property_this(&file, this_ptr, SL("_file"), PH_NOISY_CC);

			if (Z_STRLEN_P(file)) {
				php_stream *stream;

				stream = php_stream_open_wrapper(Z_STRVAL_P(file), "rb", REPORT_ERRORS, NULL);
				if (stream != NULL) {
					php_stream_passthru(stream);
					php_stream_close(stream);
				}
			}
		}

		phalcon_update_property_bool(this_ptr, SL("_sent"), 1 TSRMLS_CC);
	
		RETURN_THIS();
	}
	
	PHALCON_THROW_EXCEPTION_STR(phalcon_http_response_exception_ce, "Response was already sent");
	return;
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:61,代码来源:response.c

示例9: PHP_METHOD

/**
 * Executes the validation
 *
 * @param Phalcon\Validation $validator
 * @param string $attribute
 * @return boolean
 */
PHP_METHOD(Phalcon_Validation_Validator_Between, validate){

	zval *validator, *attribute, value = {}, allow_empty = {}, minimum = {}, maximum = {}, label = {}, pairs = {}, valid = {}, message_str = {}, code = {}, prepared = {}, message = {};
	zend_class_entry *ce = Z_OBJCE_P(getThis());

	phalcon_fetch_params(0, 2, 0, &validator, &attribute);

	PHALCON_VERIFY_CLASS_EX(validator, phalcon_validation_ce, phalcon_validation_exception_ce, 0);

	PHALCON_CALL_METHODW(&value, validator, "getvalue", attribute);

	RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&allow_empty, ce, getThis(), ISV(allowEmpty)));
	if (zend_is_true(&allow_empty) && phalcon_validation_validator_isempty_helper(&value)) {
		RETURN_TRUE;
	}

	RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&minimum, ce, getThis(), "minimum"));
	RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&maximum, ce, getThis(), "maximum"));

	PHALCON_CALL_SELFW(&valid, "valid", &value, &minimum, &maximum);

	if (PHALCON_IS_FALSE(&valid)) {
		RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&label, ce, getThis(), ISV(label)));
		if (!zend_is_true(&label)) {
			PHALCON_CALL_METHODW(&label, validator, "getlabel", attribute);
			if (!zend_is_true(&label)) {
				PHALCON_CPY_WRT_CTOR(&label, attribute);
			}
		}

		array_init_size(&pairs, 3);
		phalcon_array_update_str(&pairs, SL(":field"), &label, PH_COPY);
		phalcon_array_update_str(&pairs, SL(":min"), &minimum, PH_COPY);
		phalcon_array_update_str(&pairs, SL(":max"), &maximum, PH_COPY);

		RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&message_str, ce, getThis(), ISV(message)));
		if (!zend_is_true(&message_str)) {
			RETURN_ON_FAILURE(phalcon_validation_getdefaultmessage_helper(&message_str, Z_OBJCE_P(validator), validator, "Between"));
		}

		RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&code, ce, getThis(), ISV(code)));
		if (Z_TYPE_P(&code) == IS_NULL) {
			ZVAL_LONG(&code, 0);
		}

		PHALCON_CALL_FUNCTIONW(&prepared, "strtr", &message_str, &pairs);

		phalcon_validation_message_construct_helper(&message, &prepared, attribute, "Between", &code);

		PHALCON_CALL_METHODW(NULL, validator, "appendmessage", &message);
		RETURN_FALSE;
	}

	RETURN_TRUE;
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:62,代码来源:between.c

示例10: PHP_METHOD

/**
 * Executes the validation
 *
 * @param Phalcon\Validation $validator
 * @param string $attribute
 * @return boolean
 */
PHP_METHOD(Phalcon_Validation_Validator_Between, validate){

	zval *validator, *attribute, *value, *option = NULL, *minimum;
	zval *maximum, *valid = NULL, *type, *message_str = NULL, *message;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 2, 0, &validator, &attribute);
	
	PHALCON_INIT_VAR(value);
	phalcon_call_method_p1(value, validator, "getvalue", attribute);
	
	PHALCON_INIT_VAR(option);
	ZVAL_STRING(option, "minimum", 1);
	
	PHALCON_INIT_VAR(minimum);
	phalcon_call_method_p1(minimum, this_ptr, "getoption", option);
	
	PHALCON_INIT_NVAR(option);
	ZVAL_STRING(option, "maximum", 1);
	
	PHALCON_INIT_VAR(maximum);
	phalcon_call_method_p1(maximum, this_ptr, "getoption", option);
	
	PHALCON_INIT_VAR(valid);
	is_smaller_or_equal_function(valid, minimum, value TSRMLS_CC);
	if (zend_is_true(valid)) {
		is_smaller_or_equal_function(valid, value, maximum TSRMLS_CC);
	}
	
	if (PHALCON_IS_FALSE(valid)) {
	
		PHALCON_INIT_VAR(type);
		ZVAL_STRING(type, "Between", 1);
	
		PHALCON_INIT_NVAR(option);
		ZVAL_STRING(option, "message", 1);
	
		PHALCON_INIT_VAR(message_str);
		phalcon_call_method_p1(message_str, this_ptr, "getoption", option);
		if (!zend_is_true(message_str)) {
			PHALCON_INIT_NVAR(message_str);
			PHALCON_CONCAT_VS(message_str, attribute, " is not between a valid range");
		}
	
		PHALCON_INIT_VAR(message);
		object_init_ex(message, phalcon_validation_message_ce);
		phalcon_call_method_p3_noret(message, "__construct", message_str, attribute, type);
	
		phalcon_call_method_p1_noret(validator, "appendmessage", message);
		RETURN_MM_FALSE;
	}
	
	RETURN_MM_TRUE;
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:62,代码来源:between.c

示例11: PHP_METHOD

/**
 * Starts the session (if headers are already sent the session will not started)
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Session_Adapter, start){

	zval *headers_sent;

	PHALCON_MM_GROW();

	PHALCON_INIT_VAR(headers_sent);
	PHALCON_CALL_FUNC(headers_sent, "headers_sent");
	if (PHALCON_IS_FALSE(headers_sent)) {
		PHALCON_CALL_FUNC_NORETURN("session_start");
		phalcon_update_property_bool(this_ptr, SL("_started"), 1 TSRMLS_CC);
		RETURN_MM_TRUE;
	}
	
	RETURN_MM_FALSE;
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:21,代码来源:adapter.c

示例12: PHP_METHOD

PHP_METHOD(Phalcon_Mvc_Collection_GridFS, saveBytes){

	zval *bytes, *arr = NULL, *white_list = NULL, *mode = NULL;
	zval *old_sha1, *old_md5, *sha1 = NULL, *md5 = NULL, *status = NULL;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 3, &bytes, &arr, &white_list, &mode);

	if (!arr) {
		arr = &PHALCON_GLOBAL(z_null);
	}

	if (!white_list) {
		white_list = &PHALCON_GLOBAL(z_null);
	}

	if (!mode) {
		mode = &PHALCON_GLOBAL(z_null);
	}

	if (zend_is_true(bytes)) {
		old_sha1 = phalcon_read_property(getThis(), SL("sha1"), PH_NOISY);
		old_md5 = phalcon_read_property(getThis(), SL("md5"), PH_NOISY);

		PHALCON_CALL_FUNCTION(&sha1, "sha1", bytes);
		PHALCON_CALL_FUNCTION(&md5, "md5", bytes);

		phalcon_update_property_this(getThis(), SL("sha1"), sha1);
		phalcon_update_property_this(getThis(), SL("md5"), md5);
	}

	PHALCON_CALL_PARENT(&status, phalcon_mvc_collection_gridfs_ce, getThis(), "save", arr, white_list, mode);

	if (PHALCON_IS_FALSE(status)) {
		RETURN_MM_FALSE;
	}

	if (zend_is_true(bytes)) {
		PHALCON_CALL_SELF(&status, "store", bytes, &PHALCON_GLOBAL(z_null), &PHALCON_GLOBAL(z_null), &PHALCON_GLOBAL(z_true));
		if (zend_is_true(old_sha1)) {
			PHALCON_CALL_SELF(NULL, "remove", old_sha1, old_md5);
		}
	}

	RETURN_CTOR(status);
}
开发者ID:Myleft,项目名称:cphalcon7,代码行数:47,代码来源:gridfs.c

示例13: PHP_METHOD

/**
 * Internal get wrapper to filter
 *
 * @param string $name
 * @param string|array $filters
 * @param mixed $defaultValue
 * @param boolean $notAllowEmpty
 * @param boolean $noRecursive
 * @return mixed
 */
PHP_METHOD(Phalcon_Http_Request, _get)
{
	zval *data, *name, *filters, *default_value, *not_allow_empty, *norecursive;
	zval value = {}, dependency_injector = {}, service = {}, filter = {}, filter_value = {};

	phalcon_fetch_params(0, 6, 0, &data, &name, &filters, &default_value, &not_allow_empty, &norecursive);

	if (Z_TYPE_P(name) != IS_NULL) {
		if (!phalcon_array_isset_fetch(&value, data, name, 0)) {
			RETURN_CTORW(default_value);
		}
	} else {
		PHALCON_CPY_WRT_CTOR(&value, data);
	}

	if (Z_TYPE_P(filters) != IS_NULL) {
		phalcon_return_property(&filter, getThis(), SL("_filter"));
		if (Z_TYPE(filter) != IS_OBJECT) {
			PHALCON_CALL_METHODW(&dependency_injector, getThis(), "getdi");
			if (Z_TYPE(dependency_injector) != IS_OBJECT) {
				PHALCON_THROW_EXCEPTION_STRW(phalcon_http_request_exception_ce, "A dependency injection object is required to access the 'filter' service");
				return;
			}

			PHALCON_STR(&service, ISV(filter));

			PHALCON_CALL_METHODW(&filter, &dependency_injector, "getshared", &service);
			PHALCON_VERIFY_INTERFACEW(&filter, phalcon_filterinterface_ce);

			phalcon_update_property_zval(getThis(), SL("_filter"), &filter);
		}

		PHALCON_CALL_METHODW(&filter_value, &filter, "sanitize", &value, filters, norecursive);

		if ((PHALCON_IS_EMPTY(&filter_value) && zend_is_true(not_allow_empty)) || PHALCON_IS_FALSE(&filter_value)) {
			RETURN_CTORW(default_value);
		}

		RETURN_CTORW(&filter_value);
	}

	if (PHALCON_IS_EMPTY(&value) && zend_is_true(not_allow_empty)) {
		RETURN_CTORW(default_value);
	}

	RETURN_CTORW(&value);
}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:57,代码来源:request.c

示例14: PHP_METHOD

/**
 * Returns a cached content
 *
 * @param int|string $keyName
 * @param   long $lifetime
 * @return  mixed
 */
PHP_METHOD(Phalcon_Cache_Backend_Memcache, get){

	zval *key_name, *lifetime = NULL, *memcache = NULL, *frontend;
	zval *prefix, *prefixed_key, *cached_content;
	zval *content;

	PHALCON_MM_GROW();

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

	if (!lifetime) {
		PHALCON_INIT_VAR(lifetime);
	}
	
	PHALCON_OBS_VAR(memcache);
	phalcon_read_property(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
	if (Z_TYPE_P(memcache) != IS_OBJECT) {
		PHALCON_CALL_METHOD_NORETURN(this_ptr, "_connect");
	
		PHALCON_OBS_NVAR(memcache);
		phalcon_read_property(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
	}
	
	PHALCON_OBS_VAR(frontend);
	phalcon_read_property(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(prefix);
	phalcon_read_property(&prefix, this_ptr, SL("_prefix"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(prefixed_key);
	PHALCON_CONCAT_VV(prefixed_key, prefix, key_name);
	phalcon_update_property_zval(this_ptr, SL("_lastKey"), prefixed_key TSRMLS_CC);
	
	PHALCON_INIT_VAR(cached_content);
	PHALCON_CALL_METHOD_PARAMS_1(cached_content, memcache, "get", prefixed_key);
	if (PHALCON_IS_FALSE(cached_content)) {
		RETURN_MM_NULL();
	}
	
	PHALCON_INIT_VAR(content);
	PHALCON_CALL_METHOD_PARAMS_1(content, frontend, "afterretrieve", cached_content);
	
	RETURN_CCTOR(content);
}
开发者ID:Gildus,项目名称:cphalcon,代码行数:53,代码来源:memcache.c

示例15: PHP_METHOD

/**
 * Executes the validation
 *
 * @param string $value
 * @return boolean
 */
PHP_METHOD(Phalcon_Validation_Validator_Between, valid){

	zval *value, *minimum = NULL, *maximum = NULL, *valid;
	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 3, 0, &value, &minimum, &maximum);

	PHALCON_INIT_VAR(valid);
	is_smaller_or_equal_function(valid, minimum, value TSRMLS_CC);
	if (zend_is_true(valid)) {
		is_smaller_or_equal_function(valid, value, maximum TSRMLS_CC);
	}
	
	if (PHALCON_IS_FALSE(valid)) {
		RETURN_MM_FALSE;
	}
	
	RETURN_MM_TRUE;
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:25,代码来源:between.c


注:本文中的PHALCON_IS_FALSE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。