コード例 #1
0
ファイル: Ternary.c プロジェクト: dshum/Lemon-Tree-2.0
ONPHP_METHOD(Ternary, spawn)
{
	zval *value, *true, *false, *null, *result, *out;
	
	ONPHP_GET_ARGS("zzz|z", &value, &true, &false, &null);
	
	ALLOC_INIT_ZVAL(result);
	
	ONPHP_MAKE_OBJECT(Ternary, out);
	
	if (ZEND_NUM_ARGS() == 3) {
		ALLOC_INIT_ZVAL(null);
		ZVAL_NULL(null);
	}
	
	if (
		is_identical_function(result, value, true TSRMLS_CC)
		&& (zval_is_true(result))
	) {
		ONPHP_UPDATE_PROPERTY_BOOL(out, "trinity", 1);
	} else if (
		is_identical_function(result, value, false TSRMLS_CC)
		&& (zval_is_true(result))
	) {
		ONPHP_UPDATE_PROPERTY_BOOL(out, "trinity", 0);
	} else if (
		(
			is_identical_function(result, value, null TSRMLS_CC)
			&& (zval_is_true(result))
		) || (
			Z_TYPE_P(null) == IS_NULL
		)
	) {
		ONPHP_UPDATE_PROPERTY_NULL(out, "trinity");
	} else {
		ONPHP_THROW_NORET(WrongArgumentException, "failed to spawn Ternary");
	}
	
	ZVAL_FREE(result);
	
	if (ZEND_NUM_ARGS() == 3) {
		ZVAL_FREE(null);
	}
	
	if (EG(exception)) {
		return;
	}
	
	RETURN_ZVAL(out, 1, 1);
}
コード例 #2
0
ファイル: request.c プロジェクト: dreamsxin/cphalcon7
/**
 * Checks whether request has been made using any secure layer
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Http_Request, isSecureRequest)
{
	zval scheme = {}, https = {};

	PHALCON_CALL_METHODW(&scheme, getThis(), "getscheme");

	PHALCON_STR(&https, "https");
	is_identical_function(return_value, &https, &scheme);
}
コード例 #3
0
ファイル: validator.c プロジェクト: xingskycn/cphalcon
/**
 * Check whether option "required" has been passed as option
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Model_Validator, isRequired){

	zval *v0 = NULL;
	zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *t5 = NULL;
	zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL;
	int eval_int;

	PHALCON_MM_GROW();
	PHALCON_INIT_VAR(v0);
	ZVAL_BOOL(v0, 1);
	PHALCON_ALLOC_ZVAL_MM(t0);
	phalcon_read_property(&t0, this_ptr, "_value", sizeof("_value")-1, PHALCON_NOISY_FETCH TSRMLS_CC);
	PHALCON_INIT_VAR(t1);
	ZVAL_STRING(t1, "", 1);
	PHALCON_INIT_VAR(r0);
	is_identical_function(r0, t1, t0 TSRMLS_CC);
	PHALCON_ALLOC_ZVAL_MM(t2);
	phalcon_read_property(&t2, this_ptr, "_value", sizeof("_value")-1, PHALCON_NOISY_FETCH TSRMLS_CC);
	PHALCON_INIT_VAR(t3);
	ZVAL_NULL(t3);
	PHALCON_INIT_VAR(r1);
	is_identical_function(r1, t3, t2 TSRMLS_CC);
	PHALCON_INIT_VAR(r2);
	ZVAL_BOOL(r2, zend_is_true(r0) || zend_is_true(r1));
	if (zend_is_true(r2)) {
		PHALCON_ALLOC_ZVAL_MM(t4);
		phalcon_read_property(&t4, this_ptr, "_options", sizeof("_options")-1, PHALCON_NOISY_FETCH TSRMLS_CC);
		eval_int = phalcon_array_isset_string(t4, "required", strlen("required")+1);
		if (eval_int) {
			PHALCON_ALLOC_ZVAL_MM(t5);
			phalcon_read_property(&t5, this_ptr, "_options", sizeof("_options")-1, PHALCON_NOISY_FETCH TSRMLS_CC);
			PHALCON_ALLOC_ZVAL_MM(r3);
			phalcon_array_fetch_string(&r3, t5, "required", strlen("required"), PHALCON_NOISY_FETCH TSRMLS_CC);
			PHALCON_CPY_WRT(v0, r3);
		}
		PHALCON_RETURN_CHECK_CTOR(v0);
	} else {
		PHALCON_MM_RESTORE();
		RETURN_TRUE;
	}
	PHALCON_MM_RESTORE();
	RETURN_NULL();
}
コード例 #4
0
ファイル: request.c プロジェクト: CreativeOutbreak/cphalcon
/**
 * Checks whether request has been made using any secure layer
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Http_Request, isSecureRequest){

	zval *scheme, *https;

	PHALCON_MM_GROW();

	PHALCON_INIT_VAR(scheme);
	phalcon_call_method(scheme, this_ptr, "getscheme");
	
	PHALCON_INIT_VAR(https);
	ZVAL_STRING(https, "https", 1);
	is_identical_function(return_value, https, scheme TSRMLS_CC);
	RETURN_MM();
}
コード例 #5
0
ファイル: request.c プロジェクト: loudertech/cphalcon
/**
 * Checks whether request has been made using any secure layer
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Request, isSecureRequest){

	zval *r0 = NULL, *r1 = NULL;
	zval *t0 = NULL;

	PHALCON_MM_GROW();
	PHALCON_ALLOC_ZVAL_MM(r0);
	PHALCON_CALL_METHOD(r0, this_ptr, "getscheme", PHALCON_NO_CHECK);
	PHALCON_INIT_VAR(t0);
	ZVAL_STRING(t0, "https", 1);
	PHALCON_INIT_VAR(r1);
	is_identical_function(r1, t0, r0 TSRMLS_CC);
	
	PHALCON_RETURN_NCTOR(r1);
}
コード例 #6
0
ファイル: request.c プロジェクト: BlueShark/cphalcon
/**
 * Checks whether request has been made using any secure layer
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Http_Request, isSecureRequest){

	zval *scheme, *https, *is_equal;

	PHALCON_MM_GROW();

	PHALCON_INIT_VAR(scheme);
	PHALCON_CALL_METHOD(scheme, this_ptr, "getscheme");
	
	PHALCON_INIT_VAR(https);
	ZVAL_STRING(https, "https", 1);
	
	PHALCON_INIT_VAR(is_equal);
	is_identical_function(is_equal, https, scheme TSRMLS_CC);
	RETURN_NCTOR(is_equal);
}
コード例 #7
0
ファイル: array.c プロジェクト: wuthering-bytes/vroom
static zend_always_inline int 	__case_compare_function ( zval *  result, zval *  op1, zval *  op2, int  identical TSRMLS_DC  )  
   {
	switch ( TYPE_PAIR ( Z_TYPE_P ( op1 ), Z_TYPE_P ( op2 ) ) ) 
	   {
		case TYPE_PAIR ( IS_STRING, IS_STRING ) :
			Z_LVAL_P ( result ) 	=  zend_binary_zval_strcasecmp ( op1, op2 ) ;
			ZVAL_LONG ( result, ZEND_NORMALIZE_BOOL ( Z_LVAL_P ( result ) ) ) ;				
			return ( SUCCESS ) ;
			
		default :
			return ( ( identical ) ? 
					is_equal_function 	( result, op1, op2 TSRMLS_CC ) :
					is_identical_function   ( result, op1, op2 TSRMLS_CC )
				) ;
	    }
    }
コード例 #8
0
ファイル: request.c プロジェクト: meibk/cphalcon
/**
 * Checks whether request has been made using any secure layer
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Http_Request, isSecureRequest){

	zval *scheme = NULL, *is_equal = NULL;
	zval *t0 = NULL;

	PHALCON_MM_GROW();
	PHALCON_INIT_VAR(scheme);
	PHALCON_CALL_METHOD(scheme, this_ptr, "getscheme", PH_NO_CHECK);
	
	PHALCON_INIT_VAR(t0);
	ZVAL_STRING(t0, "https", 1);
	
	PHALCON_INIT_VAR(is_equal);
	is_identical_function(is_equal, t0, scheme TSRMLS_CC);
	
	RETURN_NCTOR(is_equal);
}