本文整理汇总了C++中zephir_get_strval函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_get_strval函数的具体用法?C++ zephir_get_strval怎么用?C++ zephir_get_strval使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_get_strval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Encrypts a text
*
*<code>
* $encrypted = $crypt->encrypt("Ultra-secret text", "encrypt password");
*</code>
*/
PHP_METHOD(Phalcon_Crypt, encrypt) {
zend_bool _4, _5;
zephir_nts_static zephir_fcall_cache_entry *_2 = NULL, *_6 = NULL;
int ZEPHIR_LAST_CALL_STATUS, _3;
zval *text_param = NULL, *key_param = NULL, *encryptKey = NULL, *ivSize = NULL, *iv = NULL, *cipher, *mode, *blockSize = NULL, *paddingType, *padded = NULL, _0, *_1 = NULL;
zval *text = NULL, *key = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &text_param, &key_param);
if (unlikely(Z_TYPE_P(text_param) != IS_STRING && Z_TYPE_P(text_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'text' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(text_param) == IS_STRING)) {
zephir_get_strval(text, text_param);
} else {
ZEPHIR_INIT_VAR(text);
ZVAL_EMPTY_STRING(text);
}
if (!key_param) {
ZEPHIR_INIT_VAR(key);
ZVAL_EMPTY_STRING(key);
} else {
if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(key_param) == IS_STRING)) {
zephir_get_strval(key, key_param);
} else {
ZEPHIR_INIT_VAR(key);
ZVAL_EMPTY_STRING(key);
}
}
if (!((zephir_function_exists_ex(SS("mcrypt_get_iv_size") TSRMLS_CC) == SUCCESS))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_crypt_exception_ce, "mcrypt extension is required", "phalcon/crypt.zep", 306);
return;
}
if (ZEPHIR_IS_STRING_IDENTICAL(key, "")) {
ZEPHIR_OBS_VAR(encryptKey);
zephir_read_property_this(&encryptKey, this_ptr, SL("_key"), PH_NOISY_CC);
} else {
ZEPHIR_CPY_WRT(encryptKey, key);
}
if (ZEPHIR_IS_EMPTY(encryptKey)) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_crypt_exception_ce, "Encryption key cannot be empty", "phalcon/crypt.zep", 316);
return;
}
ZEPHIR_OBS_VAR(cipher);
zephir_read_property_this(&cipher, this_ptr, SL("_cipher"), PH_NOISY_CC);
ZEPHIR_OBS_VAR(mode);
zephir_read_property_this(&mode, this_ptr, SL("_mode"), PH_NOISY_CC);
ZEPHIR_CALL_FUNCTION(&ivSize, "mcrypt_get_iv_size", NULL, cipher, mode);
zephir_check_call_status();
if (ZEPHIR_LT_LONG(ivSize, zephir_fast_strlen_ev(encryptKey))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_crypt_exception_ce, "Size of key is too large for this algorithm", "phalcon/crypt.zep", 324);
return;
}
ZEPHIR_SINIT_VAR(_0);
ZVAL_LONG(&_0, 2);
ZEPHIR_CALL_FUNCTION(&iv, "mcrypt_create_iv", NULL, ivSize, &_0);
zephir_check_call_status();
if (Z_TYPE_P(iv) != IS_STRING) {
ZEPHIR_CALL_FUNCTION(&_1, "strval", &_2, iv);
zephir_check_call_status();
ZEPHIR_CPY_WRT(iv, _1);
}
ZEPHIR_CALL_FUNCTION(&blockSize, "mcrypt_get_block_size", NULL, cipher, mode);
zephir_check_call_status();
if (Z_TYPE_P(blockSize) != IS_LONG) {
_3 = zephir_get_intval(blockSize);
ZEPHIR_INIT_NVAR(blockSize);
ZVAL_LONG(blockSize, _3);
}
ZEPHIR_OBS_VAR(paddingType);
zephir_read_property_this(&paddingType, this_ptr, SL("_padding"), PH_NOISY_CC);
_4 = !ZEPHIR_IS_LONG(paddingType, 0);
if (_4) {
_5 = ZEPHIR_IS_STRING(mode, "cbc");
if (!(_5)) {
_5 = ZEPHIR_IS_STRING(mode, "ecb");
}
_4 = _5;
}
if (_4) {
ZEPHIR_CALL_METHOD(&padded, this_ptr, "_cryptpadtext", &_6, text, mode, blockSize, paddingType);
zephir_check_call_status();
//.........这里部分代码省略.........
示例2: PHP_METHOD
/**
* Performs a string conversion
*/
PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) {
int ZEPHIR_LAST_CALL_STATUS;
zend_bool _0, _1;
zval *text_param = NULL, *from_param = NULL, *to_param = NULL;
zval *text = NULL, *from = NULL, *to = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 0, &text_param, &from_param, &to_param);
zephir_get_strval(text, text_param);
if (unlikely(Z_TYPE_P(from_param) != IS_STRING && Z_TYPE_P(from_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'from' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(from_param) == IS_STRING)) {
zephir_get_strval(from, from_param);
} else {
ZEPHIR_INIT_VAR(from);
ZVAL_EMPTY_STRING(from);
}
if (unlikely(Z_TYPE_P(to_param) != IS_STRING && Z_TYPE_P(to_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'to' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(to_param) == IS_STRING)) {
zephir_get_strval(to, to_param);
} else {
ZEPHIR_INIT_VAR(to);
ZVAL_EMPTY_STRING(to);
}
_0 = ZEPHIR_IS_STRING(from, "latin1");
if (!(_0)) {
_0 = ZEPHIR_IS_STRING(to, "utf8");
}
if (_0) {
ZEPHIR_RETURN_CALL_FUNCTION("utf8_encode", NULL, 376, text);
zephir_check_call_status();
RETURN_MM();
}
_1 = ZEPHIR_IS_STRING(to, "latin1");
if (!(_1)) {
_1 = ZEPHIR_IS_STRING(from, "utf8");
}
if (_1) {
ZEPHIR_RETURN_CALL_FUNCTION("utf8_decode", NULL, 377, text);
zephir_check_call_status();
RETURN_MM();
}
if ((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS)) {
ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 180, text, from, to);
zephir_check_call_status();
RETURN_MM();
}
if ((zephir_function_exists_ex(SS("iconv") TSRMLS_CC) == SUCCESS)) {
ZEPHIR_RETURN_CALL_FUNCTION("iconv", NULL, 378, from, to, text);
zephir_check_call_status();
RETURN_MM();
}
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Any of 'mbstring' or 'iconv' is required to perform the charset conversion", "phalcon/mvc/view/engine/volt.zep", 205);
return;
}
示例3: PHP_METHOD
/**
* Extracts parameters from a string
*
* @param string pattern
*/
PHP_METHOD(Test_Router_Route, extractNamedParams) {
zend_bool notValid;
int tmp, cursor, cursorVar, marker, bracketCount = 0, parenthesesCount = 0, foundPattern = 0, intermediate = 0, numberMatches = 0, _0, _5, _10;
char ch;
zval *pattern_param = NULL, *matches, _1 = zval_used_for_init, _2 = zval_used_for_init, *_3 = NULL, *_6 = NULL, *_8 = NULL;
zval *pattern = NULL, *route, *item = NULL, *variable = NULL, *regexp = NULL, *_4 = NULL, *_7 = NULL, *_9 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &pattern_param);
zephir_get_strval(pattern, pattern_param);
if ((zephir_fast_strlen_ev(pattern) <= 0)) {
RETURN_MM_BOOL(0);
}
ZEPHIR_INIT_VAR(matches);
array_init(matches);
ZEPHIR_INIT_VAR(route);
ZVAL_EMPTY_STRING(route);
for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) {
cursor = _0;
ch = Z_STRVAL_P(pattern)[_0];
if ((parenthesesCount == 0)) {
if ((ch == '{')) {
if ((bracketCount == 0)) {
marker = (cursor + 1);
intermediate = 0;
notValid = 0;
}
bracketCount++;
} else {
if ((ch == '}')) {
bracketCount--;
if ((intermediate > 0)) {
if ((bracketCount == 0)) {
numberMatches++;
ZEPHIR_INIT_NVAR(variable);
ZVAL_EMPTY_STRING(variable);
ZEPHIR_INIT_NVAR(regexp);
ZVAL_EMPTY_STRING(regexp);
ZEPHIR_SINIT_NVAR(_1);
ZVAL_LONG(&_1, marker);
ZEPHIR_SINIT_NVAR(_2);
ZVAL_LONG(&_2, (cursor - marker));
ZEPHIR_INIT_NVAR(_3);
zephir_call_func_p3(_3, "substr", pattern, &_1, &_2);
zephir_get_strval(_4, _3);
ZEPHIR_CPY_WRT(item, _4);
for (_5 = 0; _5 < Z_STRLEN_P(item); _5++) {
cursorVar = _5;
ch = Z_STRVAL_P(item)[_5];
if ((ch == '\0')) {
break;
}
if (((cursorVar == 0) && !(((((ch >= 'a') && (ch <= 'z'))) || (((ch >= 'A') && (ch <= 'Z'))))))) {
notValid = 1;
break;
}
if (((((((((ch >= 'a') && (ch <= 'z'))) || (((ch >= 'A') && (ch <= 'Z')))) || (((ch >= '0') && (ch <= '9')))) || (ch == '-')) || (ch == '_')) || (ch == ':'))) {
if ((ch == ':')) {
ZEPHIR_SINIT_NVAR(_1);
ZVAL_LONG(&_1, 0);
ZEPHIR_SINIT_NVAR(_2);
ZVAL_LONG(&_2, cursorVar);
ZEPHIR_INIT_NVAR(_6);
zephir_call_func_p3(_6, "substr", item, &_1, &_2);
zephir_get_strval(_7, _6);
ZEPHIR_CPY_WRT(variable, _7);
ZEPHIR_SINIT_NVAR(_1);
ZVAL_LONG(&_1, (cursorVar + 1));
ZEPHIR_INIT_NVAR(_8);
zephir_call_func_p2(_8, "substr", item, &_1);
zephir_get_strval(_9, _8);
ZEPHIR_CPY_WRT(regexp, _9);
break;
}
} else {
notValid = 1;
break;
}
}
if (!(notValid)) {
tmp = numberMatches;
if ((variable && Z_STRLEN_P(variable)) && (regexp && Z_STRLEN_P(regexp))) {
foundPattern = 0;
for (_10 = 0; _10 < Z_STRLEN_P(regexp); _10++) {
ch = Z_STRVAL_P(regexp)[_10];
if ((ch == '\0')) {
break;
}
if (!(foundPattern)) {
if ((ch == '(')) {
foundPattern = 1;
//.........这里部分代码省略.........
示例4: PHP_METHOD
/**
* Resolves the service based on its configuration
*/
PHP_METHOD(Phalcon_Di, get) {
zend_bool _6$$6;
zval *_1$$3, *_7$$12;
int ZEPHIR_LAST_CALL_STATUS;
zval *name_param = NULL, *parameters = NULL, *service = NULL, *eventsManager = NULL, *instance = NULL, *_0, *_2$$3, *_3$$4, *_4$$7, *_8$$12;
zval *name = NULL, *_5$$7;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &name_param, ¶meters);
if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(name_param) == IS_STRING)) {
zephir_get_strval(name, name_param);
} else {
ZEPHIR_INIT_VAR(name);
ZVAL_EMPTY_STRING(name);
}
if (!parameters) {
parameters = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_INIT_VAR(instance);
ZVAL_NULL(instance);
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(eventsManager, _0);
if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
ZEPHIR_INIT_VAR(_1$$3);
zephir_create_array(_1$$3, 2, 0 TSRMLS_CC);
zephir_array_update_string(&_1$$3, SL("name"), &name, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&_1$$3, SL("parameters"), ¶meters, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_VAR(_2$$3);
ZVAL_STRING(_2$$3, "di:beforeServiceResolve", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&instance, eventsManager, "fire", NULL, 0, _2$$3, this_ptr, _1$$3);
zephir_check_temp_parameter(_2$$3);
zephir_check_call_status();
}
if (Z_TYPE_P(instance) != IS_OBJECT) {
ZEPHIR_OBS_VAR(service);
_3$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_services"), PH_NOISY_CC);
if (zephir_array_isset_fetch(&service, _3$$4, name, 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(&instance, service, "resolve", NULL, 0, parameters, this_ptr);
zephir_check_call_status();
} else {
if (!(zephir_class_exists(name, 1 TSRMLS_CC))) {
ZEPHIR_INIT_VAR(_4$$7);
object_init_ex(_4$$7, phalcon_di_exception_ce);
ZEPHIR_INIT_VAR(_5$$7);
ZEPHIR_CONCAT_SVS(_5$$7, "Service '", name, "' wasn't found in the dependency injection container");
ZEPHIR_CALL_METHOD(NULL, _4$$7, "__construct", NULL, 9, _5$$7);
zephir_check_call_status();
zephir_throw_exception_debug(_4$$7, "phalcon/di.zep", 236 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
_6$$6 = Z_TYPE_P(parameters) == IS_ARRAY;
if (_6$$6) {
_6$$6 = ((zephir_fast_count_int(parameters TSRMLS_CC)) ? 1 : 0);
}
if (_6$$6) {
ZEPHIR_INIT_NVAR(instance);
ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(instance, name, parameters TSRMLS_CC);
zephir_check_call_status();
} else {
ZEPHIR_INIT_NVAR(instance);
ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(instance, name TSRMLS_CC);
zephir_check_call_status();
}
}
}
if (Z_TYPE_P(instance) == IS_OBJECT) {
if (zephir_instance_of_ev(instance, phalcon_di_injectionawareinterface_ce TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(NULL, instance, "setdi", NULL, 0, this_ptr);
zephir_check_call_status();
}
}
if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
ZEPHIR_INIT_VAR(_7$$12);
zephir_create_array(_7$$12, 3, 0 TSRMLS_CC);
zephir_array_update_string(&_7$$12, SL("name"), &name, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&_7$$12, SL("parameters"), ¶meters, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&_7$$12, SL("instance"), &instance, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_VAR(_8$$12);
ZVAL_STRING(_8$$12, "di:afterServiceResolve", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _8$$12, this_ptr, _7$$12);
zephir_check_temp_parameter(_8$$12);
zephir_check_call_status();
}
RETURN_CCTOR(instance);
}
示例5: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_Date, validate) {
int ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *value = NULL, *format = NULL, *label = NULL, *message = NULL, *replacePairs = NULL, *_0, *_2 = NULL, *_1$$3, *_3$$5 = NULL, *_7$$5 = NULL, *_8$$5, *_4$$6, *_5$$8, *_6$$9;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "format", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&format, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(format) == IS_ARRAY) {
zephir_array_fetch(&_1$$3, format, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/date.zep", 77 TSRMLS_CC);
ZEPHIR_CPY_WRT(format, _1$$3);
}
if (ZEPHIR_IS_EMPTY(format)) {
ZEPHIR_INIT_NVAR(format);
ZVAL_STRING(format, "Y-m-d", 1);
}
ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdate", NULL, 470, value, format);
zephir_check_call_status();
if (!(zephir_is_true(_2))) {
ZEPHIR_INIT_VAR(_3$$5);
ZVAL_STRING(_3$$5, "label", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _3$$5);
zephir_check_temp_parameter(_3$$5);
zephir_check_call_status();
if (Z_TYPE_P(label) == IS_ARRAY) {
zephir_array_fetch(&_4$$6, label, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/date.zep", 87 TSRMLS_CC);
ZEPHIR_CPY_WRT(label, _4$$6);
}
if (ZEPHIR_IS_EMPTY(label)) {
ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_3$$5);
ZVAL_STRING(_3$$5, "message", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$5);
zephir_check_temp_parameter(_3$$5);
zephir_check_call_status();
if (Z_TYPE_P(message) == IS_ARRAY) {
zephir_array_fetch(&_5$$8, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/date.zep", 95 TSRMLS_CC);
ZEPHIR_CPY_WRT(message, _5$$8);
}
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
if (ZEPHIR_IS_EMPTY(message)) {
ZEPHIR_INIT_VAR(_6$$9);
ZVAL_STRING(_6$$9, "Date", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _6$$9);
zephir_check_temp_parameter(_6$$9);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_3$$5);
object_init_ex(_3$$5, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_7$$5, "strtr", NULL, 26, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_8$$5);
ZVAL_STRING(_8$$5, "Date", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _3$$5, "__construct", NULL, 464, _7$$5, field, _8$$5);
zephir_check_temp_parameter(_8$$5);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$5);
zephir_check_call_status();
RETURN_MM_BOOL(0);
}
RETURN_MM_BOOL(1);
}
示例6: PHP_METHOD
//.........这里部分代码省略.........
return;
}
ZEPHIR_INIT_VAR(_8$$11);
ZVAL_STRING(_8$$11, "router", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_7$$11, dependencyInjector, "getshared", NULL, 0, _8$$11);
zephir_check_temp_parameter(_8$$11);
zephir_check_call_status();
ZEPHIR_CPY_WRT(router, _7$$11);
zephir_update_property_this(getThis(), SL("_router"), router TSRMLS_CC);
}
ZEPHIR_CALL_METHOD(&_9$$9, router, "getroutebyname", NULL, 0, routeName);
zephir_check_call_status();
ZEPHIR_CPY_WRT(route, _9$$9);
if (Z_TYPE_P(route) != IS_OBJECT) {
ZEPHIR_INIT_VAR(_10$$13);
object_init_ex(_10$$13, phalcon_mvc_url_exception_ce);
ZEPHIR_INIT_VAR(_11$$13);
ZEPHIR_CONCAT_SVS(_11$$13, "Cannot obtain a route using the name '", routeName, "'");
ZEPHIR_CALL_METHOD(NULL, _10$$13, "__construct", NULL, 9, _11$$13);
zephir_check_call_status();
zephir_throw_exception_debug(_10$$13, "phalcon/mvc/url.zep", 250 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_INIT_VAR(_12$$9);
ZEPHIR_CALL_METHOD(&_9$$9, route, "getpattern", NULL, 0);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_13$$9, route, "getreversedpaths", NULL, 0);
zephir_check_call_status();
phalcon_replace_paths(_12$$9, _9$$9, _13$$9, uri TSRMLS_CC);
ZEPHIR_CPY_WRT(uri, _12$$9);
}
if (zephir_is_true(local)) {
zephir_get_strval(_14$$14, uri);
ZEPHIR_CPY_WRT(strUri, _14$$14);
_15$$14 = ZEPHIR_IS_STRING(baseUri, "/");
if (_15$$14) {
_15$$14 = zephir_fast_strlen_ev(strUri) > 2;
}
_16$$14 = _15$$14;
if (_16$$14) {
_17$$14 = ZEPHIR_STRING_OFFSET(strUri, 0);
_16$$14 = _17$$14 == '/';
}
_18$$14 = _16$$14;
if (_18$$14) {
_19$$14 = ZEPHIR_STRING_OFFSET(strUri, 1);
_18$$14 = _19$$14 != '/';
}
if (_18$$14) {
ZEPHIR_SINIT_VAR(_20$$15);
ZVAL_LONG(&_20$$15, 1);
ZEPHIR_INIT_VAR(_21$$15);
zephir_substr(_21$$15, strUri, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH);
ZEPHIR_INIT_NVAR(uri);
ZEPHIR_CONCAT_VV(uri, baseUri, _21$$15);
} else {
_22$$16 = ZEPHIR_IS_STRING(baseUri, "/");
if (_22$$16) {
_22$$16 = zephir_fast_strlen_ev(strUri) == 1;
}
_23$$16 = _22$$16;
if (_23$$16) {
_24$$16 = ZEPHIR_STRING_OFFSET(strUri, 0);
_23$$16 = _24$$16 == '/';
}
示例7: PHP_METHOD
/**
* The plural version of gettext().
* Some languages have more than one form for plural messages dependent on the count.
*
* @param string msgid1
* @param string msgid2
* @param int count
* @param array placeholders
* @param string domain
*
* @return string
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) {
int count, ZEPHIR_LAST_CALL_STATUS;
zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, _0$$3, _1$$4;
zval *msgid1 = NULL, *msgid2 = NULL, *domain = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 2, &msgid1_param, &msgid2_param, &count_param, &placeholders, &domain_param);
if (unlikely(Z_TYPE_P(msgid1_param) != IS_STRING && Z_TYPE_P(msgid1_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'msgid1' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(msgid1_param) == IS_STRING)) {
zephir_get_strval(msgid1, msgid1_param);
} else {
ZEPHIR_INIT_VAR(msgid1);
ZVAL_EMPTY_STRING(msgid1);
}
if (unlikely(Z_TYPE_P(msgid2_param) != IS_STRING && Z_TYPE_P(msgid2_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'msgid2' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(msgid2_param) == IS_STRING)) {
zephir_get_strval(msgid2, msgid2_param);
} else {
ZEPHIR_INIT_VAR(msgid2);
ZVAL_EMPTY_STRING(msgid2);
}
if (unlikely(Z_TYPE_P(count_param) != IS_LONG)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'count' must be a int") TSRMLS_CC);
RETURN_MM_NULL();
}
count = Z_LVAL_P(count_param);
if (!placeholders) {
placeholders = ZEPHIR_GLOBAL(global_null);
}
if (!domain_param) {
ZEPHIR_INIT_VAR(domain);
ZVAL_EMPTY_STRING(domain);
} else {
if (unlikely(Z_TYPE_P(domain_param) != IS_STRING && Z_TYPE_P(domain_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'domain' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(domain_param) == IS_STRING)) {
zephir_get_strval(domain, domain_param);
} else {
ZEPHIR_INIT_VAR(domain);
ZVAL_EMPTY_STRING(domain);
}
}
if (!(!(!domain) && Z_STRLEN_P(domain))) {
ZEPHIR_SINIT_VAR(_0$$3);
ZVAL_LONG(&_0$$3, count);
ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 435, msgid1, msgid2, &_0$$3);
zephir_check_call_status();
} else {
ZEPHIR_SINIT_VAR(_1$$4);
ZVAL_LONG(&_1$$4, count);
ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 436, domain, msgid1, msgid2, &_1$$4);
zephir_check_call_status();
}
ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders);
zephir_check_call_status();
RETURN_MM();
}
示例8: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_File, validate) {
zend_bool _1, _2, _3, _5, _6, _13, _14, _16, _22, _23, _53, _60$$16, _67$$21;
zephir_fcall_cache_entry *_11 = NULL, *_12 = NULL, *_36 = NULL;
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *_SERVER, *_POST, *_FILES, *value = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *types = NULL, *byteUnits = NULL, *unit = NULL, *maxSize = NULL, *matches = NULL, *bytes = NULL, *mime = NULL, *tmp = NULL, *width = NULL, *height = NULL, *minResolution = NULL, *maxResolution = NULL, *minWidth = NULL, *maxWidth = NULL, *minHeight = NULL, *maxHeight = NULL, *fieldTypes = NULL, *code = NULL, *minResolutionArray = NULL, *maxResolutionArray = NULL, *_0, *_4, *_7, *_15, *_17, *_18 = NULL, *_27 = NULL, *_28 = NULL, *_45 = NULL, *_52 = NULL, *_54 = NULL, *_8$$3 = NULL, *_9$$3 = NULL, *_10$$3 = NULL, *_19$$4 = NULL, *_20$$4 = NULL, *_21$$4 = NULL, *_24$$5 = NULL, *_25$$5 = NULL, *_26$$5 = NULL, *_29$$6 = NULL, *_31$$6, *_32$$6, *_33$$6, *_34$$6, *_35$$6 = NULL, *_37$$6, *_38$$6, _39$$6, *_40$$6, *_41$$6 = NULL, *_30$$7, *_42$$9 = NULL, *_43$$9 = NULL, *_44$$9 = NULL, *_46$$10, _47$$13, *_48$$13, *_49$$15 = NULL, *_50$$15 = NULL, *_51$$15 = NULL, *_55$$16, *_56$$16 = NULL, *_57$$16 = NULL, *_64$$16 = NULL, *_58$$17, *_59$$18, *_61$$20 = NULL, *_62$$20 = NULL, *_63$$20 = NULL, *_65$$21, *_66$$22, *_68$$23 = NULL, *_69$$23 = NULL, *_70$$23 = NULL;
ZEPHIR_MM_GROW();
zephir_get_global(&_FILES, SS("_FILES") TSRMLS_CC);
zephir_get_global(&_POST, SS("_POST") TSRMLS_CC);
zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
zephir_check_call_status();
zephir_array_fetch_string(&_0, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 109 TSRMLS_CC);
_1 = ZEPHIR_IS_STRING(_0, "POST");
if (_1) {
_1 = ZEPHIR_IS_EMPTY(_POST);
}
_2 = _1;
if (_2) {
_2 = ZEPHIR_IS_EMPTY(_FILES);
}
_3 = _2;
if (_3) {
zephir_array_fetch_string(&_4, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 109 TSRMLS_CC);
_3 = ZEPHIR_GT_LONG(_4, 0);
}
_5 = _3;
if (!(_5)) {
_6 = zephir_array_isset_string(value, SS("error"));
if (_6) {
zephir_array_fetch_string(&_7, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 109 TSRMLS_CC);
_6 = ZEPHIR_IS_LONG_IDENTICAL(_7, 1);
}
_5 = _6;
}
if (_5) {
ZEPHIR_INIT_VAR(_8$$3);
ZVAL_STRING(_8$$3, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_INIT_VAR(_9$$3);
ZVAL_STRING(_9$$3, "messageIniSize", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _8$$3, _9$$3);
zephir_check_temp_parameter(_8$$3);
zephir_check_temp_parameter(_9$$3);
zephir_check_call_status();
ZEPHIR_INIT_NVAR(_8$$3);
object_init_ex(_8$$3, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_10$$3, "strtr", &_11, 27, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_NVAR(_9$$3);
ZVAL_STRING(_9$$3, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _8$$3, "__construct", &_12, 475, _10$$3, field, _9$$3, code);
zephir_check_temp_parameter(_9$$3);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _8$$3);
zephir_check_call_status();
RETURN_MM_BOOL(0);
}
_13 = !(zephir_array_isset_string(value, SS("error")));
if (!(_13)) {
_13 = !(zephir_array_isset_string(value, SS("tmp_name")));
}
_14 = _13;
if (!(_14)) {
zephir_array_fetch_string(&_15, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 124 TSRMLS_CC);
_14 = !ZEPHIR_IS_LONG_IDENTICAL(_15, 0);
}
_16 = _14;
if (!(_16)) {
zephir_array_fetch_string(&_17, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 124 TSRMLS_CC);
ZEPHIR_CALL_FUNCTION(&_18, "is_uploaded_file", NULL, 253, _17);
zephir_check_call_status();
_16 = !zephir_is_true(_18);
}
if (_16) {
ZEPHIR_INIT_VAR(_19$$4);
ZVAL_STRING(_19$$4, "FileEmpty", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_INIT_VAR(_20$$4);
//.........这里部分代码省略.........
示例9: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_Confirmation, validate) {
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *fieldWith = NULL, *value = NULL, *valueWith = NULL, *message = NULL, *label = NULL, *labelWith = NULL, *replacePairs = NULL, *code = NULL, *_0, *_2 = NULL, *_1$$3, *_3$$4 = NULL, *_5$$4 = NULL, *_6$$4, *_4$$5;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "with", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&fieldWith, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(fieldWith) == IS_ARRAY) {
zephir_array_fetch(&_1$$3, fieldWith, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/confirmation.zep", 81 TSRMLS_CC);
ZEPHIR_CPY_WRT(fieldWith, _1$$3);
}
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&valueWith, validation, "getvalue", NULL, 0, fieldWith);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 481, value, valueWith);
zephir_check_call_status();
if (!(zephir_is_true(_2))) {
ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_3$$4);
ZVAL_STRING(_3$$4, "Confirmation", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _3$$4);
zephir_check_temp_parameter(_3$$4);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_NVAR(_3$$4);
ZVAL_STRING(_3$$4, "labelWith", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&labelWith, this_ptr, "getoption", NULL, 0, _3$$4);
zephir_check_temp_parameter(_3$$4);
zephir_check_call_status();
if (Z_TYPE_P(labelWith) == IS_ARRAY) {
zephir_array_fetch(&_4$$5, labelWith, fieldWith, PH_NOISY | PH_READONLY, "phalcon/validation/validator/confirmation.zep", 94 TSRMLS_CC);
ZEPHIR_CPY_WRT(labelWith, _4$$5);
}
if (ZEPHIR_IS_EMPTY(labelWith)) {
ZEPHIR_CALL_METHOD(&labelWith, validation, "getlabel", NULL, 0, fieldWith);
zephir_check_call_status();
}
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&replacePairs, SL(":with"), &labelWith, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_3$$4);
object_init_ex(_3$$4, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_5$$4, "strtr", NULL, 27, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_6$$4);
ZVAL_STRING(_6$$4, "Confirmation", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", NULL, 478, _5$$4, field, _6$$4, code);
zephir_check_temp_parameter(_6$$4);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$4);
zephir_check_call_status();
RETURN_MM_BOOL(0);
}
RETURN_MM_BOOL(1);
}
示例10: PHP_METHOD
/**
* Produce the routing parameters from the rewrite information
*/
PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) {
zephir_fcall_cache_entry *_9 = NULL, *_17 = NULL, *_18 = NULL;
HashTable *_2, *_7, *_11, *_15;
HashPosition _1, _6, _10, _14;
int ZEPHIR_LAST_CALL_STATUS;
zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers, *controllerSuffix, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *lowercased = NULL, *method = NULL, *collection = NULL, *_0, **_3, *_4, *_5 = NULL, **_8, **_12, *_13 = NULL, **_16;
zval *uri = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &uri_param);
if (!uri_param) {
ZEPHIR_INIT_VAR(uri);
ZVAL_EMPTY_STRING(uri);
} else {
if (unlikely(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(uri_param) == IS_STRING)) {
zephir_get_strval(uri, uri_param);
} else {
ZEPHIR_INIT_VAR(uri);
ZVAL_EMPTY_STRING(uri);
}
}
if (!(!(!uri) && Z_STRLEN_P(uri))) {
ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0);
zephir_check_call_status();
} else {
ZEPHIR_CPY_WRT(realUri, uri);
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_processed"), PH_NOISY_CC);
if (!(zephir_is_true(_0))) {
ZEPHIR_INIT_VAR(annotationsService);
ZVAL_NULL(annotationsService);
ZEPHIR_OBS_VAR(handlers);
zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC);
if (Z_TYPE_P(handlers) == IS_ARRAY) {
ZEPHIR_OBS_VAR(controllerSuffix);
zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC);
zephir_is_iterable(handlers, &_2, &_1, 0, 0, "phalcon/mvc/router/annotations.zep", 208);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
) {
ZEPHIR_GET_HVALUE(scope, _3);
if (Z_TYPE_P(scope) == IS_ARRAY) {
ZEPHIR_OBS_NVAR(prefix);
zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 117 TSRMLS_CC);
if (!(ZEPHIR_IS_EMPTY(prefix))) {
if (!(zephir_start_with(realUri, prefix, NULL))) {
continue;
}
}
if (Z_TYPE_P(annotationsService) != IS_OBJECT) {
_4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(dependencyInjector, _4);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 129);
return;
}
ZEPHIR_INIT_NVAR(_5);
ZVAL_STRING(_5, "annotations", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _5);
zephir_check_temp_parameter(_5);
zephir_check_call_status();
}
ZEPHIR_OBS_NVAR(handler);
zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 138 TSRMLS_CC);
if (zephir_memnstr_str(handler, SL("\\"), "phalcon/mvc/router/annotations.zep", 140)) {
ZEPHIR_INIT_NVAR(controllerName);
zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC);
ZEPHIR_INIT_NVAR(lowerControllerName);
zephir_uncamelize(lowerControllerName, controllerName);
ZEPHIR_INIT_NVAR(namespaceName);
zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(controllerName, handler);
ZEPHIR_INIT_NVAR(lowerControllerName);
zephir_uncamelize(lowerControllerName, controllerName);
ZEPHIR_INIT_NVAR(namespaceName);
ZVAL_NULL(namespaceName);
}
zephir_update_property_this(this_ptr, SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
ZEPHIR_OBS_NVAR(moduleName);
zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC);
ZEPHIR_INIT_NVAR(sufixed);
ZEPHIR_CONCAT_VV(sufixed, handler, controllerSuffix);
ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", NULL, 0, sufixed);
zephir_check_call_status();
if (Z_TYPE_P(handlerAnnotations) == IS_OBJECT) {
ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0);
zephir_check_call_status();
//.........这里部分代码省略.........
示例11: PHP_METHOD
/**
* Generates SQL to add an index to a table
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addIndex) {
zephir_nts_static zephir_fcall_cache_entry *_3 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *tableName_param = NULL, *schemaName_param = NULL, *index, *sql, *indexType = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL;
zval *tableName = NULL, *schemaName = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
zephir_get_strval(tableName, tableName_param);
} else {
ZEPHIR_INIT_VAR(tableName);
ZVAL_EMPTY_STRING(tableName);
}
if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
zephir_get_strval(schemaName, schemaName_param);
} else {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
}
if (Z_TYPE_P(index) != IS_OBJECT) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Index parameter must be an object compatible with Phalcon\\Db\\IndexInterface", "phalcon/db/dialect/sqlite.zep", 188);
return;
}
ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL);
zephir_check_call_status();
ZEPHIR_INIT_VAR(sql);
if (!(ZEPHIR_IS_EMPTY(indexType))) {
ZEPHIR_CONCAT_SVS(sql, "CREATE ", indexType, " INDEX \"");
} else {
ZVAL_STRING(sql, "CREATE INDEX \"", 1);
}
if (schemaName && Z_STRLEN_P(schemaName)) {
ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_1);
ZEPHIR_CONCAT_VSVSVS(_1, schemaName, "\".\"", _0, "\" ON \"", tableName, "\" (");
zephir_concat_self(&sql, _1 TSRMLS_CC);
} else {
ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_1);
ZEPHIR_CONCAT_VSVS(_1, _0, "\" ON \"", tableName, "\" (");
zephir_concat_self(&sql, _1 TSRMLS_CC);
}
ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcolumnlist", &_3, _2);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_1);
ZEPHIR_CONCAT_VS(_1, _0, ")");
zephir_concat_self(&sql, _1 TSRMLS_CC);
RETURN_CCTOR(sql);
}
示例12: PHP_METHOD
PHP_METHOD(PhalconPlus_Db_Mysql, __construct) {
zval *_2, *_4;
int ZEPHIR_LAST_CALL_STATUS;
zval *confName = NULL;
zval *di, *confName_param = NULL, *_0, *config = NULL, *dbConfig, *_1, *_3 = NULL, *_5, *_6;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &di, &confName_param);
if (unlikely(Z_TYPE_P(confName_param) != IS_STRING && Z_TYPE_P(confName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'confName' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(confName_param) == IS_STRING)) {
zephir_get_strval(confName, confName_param);
} else {
ZEPHIR_INIT_VAR(confName);
ZVAL_EMPTY_STRING(confName);
}
ZEPHIR_INIT_VAR(_0);
array_init(_0);
zephir_update_property_this(this_ptr, SL("descriptor"), _0 TSRMLS_CC);
ZEPHIR_INIT_VAR(_1);
ZVAL_STRING(_1, "config", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&config, di, "get", NULL, _1);
zephir_check_temp_parameter(_1);
zephir_check_call_status();
ZEPHIR_OBS_VAR(dbConfig);
zephir_read_property_zval(&dbConfig, config, confName, PH_NOISY_CC);
zephir_update_property_this(this_ptr, SL("di"), di TSRMLS_CC);
ZEPHIR_INIT_VAR(_2);
zephir_create_array(_2, 6, 0 TSRMLS_CC);
ZEPHIR_OBS_VAR(_3);
zephir_read_property(&_3, dbConfig, SL("host"), PH_NOISY_CC);
zephir_array_update_string(&_2, SL("host"), &_3, PH_COPY | PH_SEPARATE);
ZEPHIR_OBS_NVAR(_3);
zephir_read_property(&_3, dbConfig, SL("port"), PH_NOISY_CC);
zephir_array_update_string(&_2, SL("port"), &_3, PH_COPY | PH_SEPARATE);
ZEPHIR_OBS_NVAR(_3);
zephir_read_property(&_3, dbConfig, SL("username"), PH_NOISY_CC);
zephir_array_update_string(&_2, SL("username"), &_3, PH_COPY | PH_SEPARATE);
ZEPHIR_OBS_NVAR(_3);
zephir_read_property(&_3, dbConfig, SL("password"), PH_NOISY_CC);
zephir_array_update_string(&_2, SL("password"), &_3, PH_COPY | PH_SEPARATE);
ZEPHIR_OBS_NVAR(_3);
zephir_read_property(&_3, dbConfig, SL("dbname"), PH_NOISY_CC);
zephir_array_update_string(&_2, SL("dbname"), &_3, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_VAR(_4);
zephir_create_array(_4, 3, 0 TSRMLS_CC);
ZEPHIR_OBS_NVAR(_3);
zephir_read_property(&_3, dbConfig, SL("charset"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_5);
ZEPHIR_CONCAT_SV(_5, "SET NAMES ", _3);
zephir_array_update_long(&_4, 1002, &_5, PH_COPY, "phalconplus/Db/Mysql.zep", 29);
ZEPHIR_OBS_VAR(_6);
zephir_read_property(&_6, dbConfig, SL("timeout"), PH_NOISY_CC);
zephir_array_update_long(&_4, 2, &_6, PH_COPY, "phalconplus/Db/Mysql.zep", 29);
add_index_long(_4, 3, 2);
zephir_array_update_string(&_2, SL("options"), &_4, PH_COPY | PH_SEPARATE);
zephir_update_property_this(this_ptr, SL("descriptor"), _2 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
}
示例13: PHP_METHOD
PHP_METHOD(Test_Fasta, fastaRepeat) {
zval *_2 = NULL, *_5 = NULL;
int i, ZEPHIR_LAST_CALL_STATUS;
zval *seq = NULL;
zval *n, *seq_param = NULL, *len, *j = NULL, *k = NULL, *l, *block, *str, *lines = NULL, *_0, _1, *_3, _4, _6 = zval_used_for_init, _7 = zval_used_for_init, *_8 = NULL, *_9;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &n, &seq_param);
zephir_get_strval(seq, seq_param);
ZEPHIR_INIT_VAR(len);
ZVAL_LONG(len, zephir_fast_strlen_ev(seq));
ZEPHIR_INIT_VAR(_0);
ZEPHIR_SINIT_VAR(_1);
ZVAL_LONG(&_1, ((zephir_get_numberval(len) * 60) + 1));
zephir_create_array(_0, zephir_get_intval(&_1), 1 TSRMLS_CC);
zephir_get_arrval(_2, _0);
ZEPHIR_INIT_VAR(str);
zephir_fast_join(str, seq, _2 TSRMLS_CC);
ZEPHIR_INIT_VAR(_3);
ZEPHIR_SINIT_VAR(_4);
mul_function(&_4, len, len TSRMLS_CC);
zephir_create_array(_3, zephir_get_intval(&_4), 1 TSRMLS_CC);
zephir_get_arrval(_5, _3);
ZEPHIR_CPY_WRT(lines, _5);
ZEPHIR_INIT_VAR(j);
mul_function(j, len, len TSRMLS_CC);
i = zephir_get_numberval(j);
while (1) {
if (ZEPHIR_LE_LONG(j, -1)) {
break;
}
ZEPHIR_SEPARATE(j);
zephir_decrement(j);
ZEPHIR_SINIT_NVAR(_6);
ZVAL_LONG(&_6, (60 * zephir_get_numberval(j)));
ZEPHIR_SINIT_NVAR(_7);
ZVAL_LONG(&_7, 60);
ZEPHIR_INIT_NVAR(_8);
zephir_substr(_8, str, zephir_get_intval(&_6), 60 , 0);
zephir_array_update_zval(&lines, j, &_8, PH_COPY | PH_SEPARATE);
}
ZEPHIR_INIT_NVAR(j);
ZVAL_LONG(j, 0);
ZEPHIR_SINIT_NVAR(_6);
ZVAL_DOUBLE(&_6, zephir_safe_div_zval_long(n, 60 TSRMLS_CC));
ZEPHIR_INIT_VAR(l);
ZVAL_DOUBLE(l, zephir_floor(&_6 TSRMLS_CC));
ZEPHIR_SINIT_NVAR(_7);
ZVAL_DOUBLE(&_7, zephir_safe_div_zval_long(l, i TSRMLS_CC));
ZEPHIR_INIT_VAR(k);
ZVAL_DOUBLE(k, zephir_floor(&_7 TSRMLS_CC));
ZEPHIR_INIT_VAR(block);
zephir_fast_join_str(block, SL("\n"), lines TSRMLS_CC);
while (1) {
if (!(ZEPHIR_LT(j, k))) {
break;
}
zend_print_zval(block, 0);
ZEPHIR_SEPARATE(j);
zephir_increment(j);
}
ZEPHIR_INIT_NVAR(j);
ZVAL_LONG(j, 0);
ZEPHIR_INIT_NVAR(k);
ZVAL_DOUBLE(k, zephir_safe_mod_zval_long(l, i TSRMLS_CC));
while (1) {
if (!(ZEPHIR_LT(j, k))) {
break;
}
zephir_array_fetch(&_9, lines, j, PH_NOISY | PH_READONLY, "test/fasta.zep", 38 TSRMLS_CC);
zend_print_zval(_9, 0);
ZEPHIR_SEPARATE(j);
zephir_increment(j);
}
if (zephir_safe_mod_zval_long(n, 60 TSRMLS_CC) > 0) {
zephir_array_fetch(&_9, lines, k, PH_NOISY | PH_READONLY, "test/fasta.zep", 43 TSRMLS_CC);
ZEPHIR_SINIT_NVAR(_6);
ZVAL_LONG(&_6, 0);
ZEPHIR_SINIT_NVAR(_7);
ZVAL_DOUBLE(&_7, zephir_safe_mod_zval_long(n, 60 TSRMLS_CC));
ZEPHIR_INIT_NVAR(_8);
zephir_substr(_8, _9, 0 , zephir_get_intval(&_7), 0);
zend_print_zval(_8, 0);
}
ZEPHIR_MM_RESTORE();
}
示例14: PHP_METHOD
/**
* Magic method __get
*/
PHP_METHOD(Phalcon_Di_Injectable, __get) {
zval *_4$$7;
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_1 = NULL;
zval *propertyName_param = NULL, *dependencyInjector = NULL, *service = NULL, *persistent = NULL, *_0, *_2 = NULL, *_3$$7 = NULL, *_5$$7 = NULL;
zval *propertyName = NULL, *_6;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &propertyName_param);
if (UNEXPECTED(Z_TYPE_P(propertyName_param) != IS_STRING && Z_TYPE_P(propertyName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'propertyName' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(propertyName_param) == IS_STRING)) {
zephir_get_strval(propertyName, propertyName_param);
} else {
ZEPHIR_INIT_VAR(propertyName);
ZVAL_EMPTY_STRING(propertyName);
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(dependencyInjector, _0);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_1, 1);
zephir_check_call_status();
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "A dependency injection object is required to access the application services", "phalcon/di/injectable.zep", 127);
return;
}
}
ZEPHIR_CALL_METHOD(&_2, dependencyInjector, "has", NULL, 0, propertyName);
zephir_check_call_status();
if (zephir_is_true(_2)) {
ZEPHIR_CALL_METHOD(&service, dependencyInjector, "getshared", NULL, 0, propertyName);
zephir_check_call_status();
zephir_update_property_zval_zval(this_ptr, propertyName, service TSRMLS_CC);
RETURN_CCTOR(service);
}
if (ZEPHIR_IS_STRING(propertyName, "di")) {
zephir_update_property_this(this_ptr, SL("di"), dependencyInjector TSRMLS_CC);
RETURN_CCTOR(dependencyInjector);
}
if (ZEPHIR_IS_STRING(propertyName, "persistent")) {
ZEPHIR_INIT_VAR(_4$$7);
zephir_create_array(_4$$7, 1, 0 TSRMLS_CC);
ZEPHIR_INIT_VAR(_5$$7);
zephir_get_class(_5$$7, this_ptr, 0 TSRMLS_CC);
zephir_array_fast_append(_4$$7, _5$$7);
ZEPHIR_INIT_NVAR(_5$$7);
ZVAL_STRING(_5$$7, "sessionBag", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_3$$7, dependencyInjector, "get", NULL, 0, _5$$7, _4$$7);
zephir_check_temp_parameter(_5$$7);
zephir_check_call_status();
ZEPHIR_CPY_WRT(persistent, _3$$7);
zephir_update_property_this(this_ptr, SL("persistent"), persistent TSRMLS_CC);
RETURN_CCTOR(persistent);
}
ZEPHIR_INIT_VAR(_6);
ZEPHIR_CONCAT_SV(_6, "Access to undefined property ", propertyName);
ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", NULL, 2, _6);
zephir_check_call_status();
RETURN_MM_NULL();
}
示例15: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_Between, validate) {
zend_bool _3;
int ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *value = NULL, *minimum = NULL, *maximum = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *code = NULL, *_0 = NULL, *_1$$3, *_2$$4, *_4$$5 = NULL, *_9$$5 = NULL, *_10$$5, *_5$$6, *_6$$8, *_7$$9, *_8$$10;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "minimum", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&minimum, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
ZEPHIR_INIT_NVAR(_0);
ZVAL_STRING(_0, "maximum", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(minimum) == IS_ARRAY) {
zephir_array_fetch(&_1$$3, minimum, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/between.zep", 72 TSRMLS_CC);
ZEPHIR_CPY_WRT(minimum, _1$$3);
}
if (Z_TYPE_P(maximum) == IS_ARRAY) {
zephir_array_fetch(&_2$$4, maximum, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/between.zep", 76 TSRMLS_CC);
ZEPHIR_CPY_WRT(maximum, _2$$4);
}
_3 = ZEPHIR_LT(value, minimum);
if (!(_3)) {
_3 = ZEPHIR_GT(value, maximum);
}
if (_3) {
ZEPHIR_INIT_VAR(_4$$5);
ZVAL_STRING(_4$$5, "label", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _4$$5);
zephir_check_temp_parameter(_4$$5);
zephir_check_call_status();
if (Z_TYPE_P(label) == IS_ARRAY) {
zephir_array_fetch(&_5$$6, label, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/between.zep", 83 TSRMLS_CC);
ZEPHIR_CPY_WRT(label, _5$$6);
}
if (ZEPHIR_IS_EMPTY(label)) {
ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_4$$5);
ZVAL_STRING(_4$$5, "message", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _4$$5);
zephir_check_temp_parameter(_4$$5);
zephir_check_call_status();
if (Z_TYPE_P(message) == IS_ARRAY) {
zephir_array_fetch(&_6$$8, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/between.zep", 91 TSRMLS_CC);
ZEPHIR_CPY_WRT(message, _6$$8);
}
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 3, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&replacePairs, SL(":min"), &minimum, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&replacePairs, SL(":max"), &maximum, PH_COPY | PH_SEPARATE);
if (ZEPHIR_IS_EMPTY(message)) {
ZEPHIR_INIT_VAR(_7$$9);
ZVAL_STRING(_7$$9, "Between", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _7$$9);
zephir_check_temp_parameter(_7$$9);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_4$$5);
ZVAL_STRING(_4$$5, "code", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&code, this_ptr, "getoption", NULL, 0, _4$$5);
zephir_check_temp_parameter(_4$$5);
zephir_check_call_status();
if (Z_TYPE_P(code) == IS_ARRAY) {
zephir_array_fetch(&_8$$10, code, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/between.zep", 100 TSRMLS_CC);
ZEPHIR_CPY_WRT(code, _8$$10);
}
ZEPHIR_INIT_NVAR(_4$$5);
object_init_ex(_4$$5, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_9$$5, "strtr", NULL, 26, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_10$$5);
ZVAL_STRING(_10$$5, "Between", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _4$$5, "__construct", NULL, 462, _9$$5, field, _10$$5, code);
//.........这里部分代码省略.........